In order to do what you want, I would like to advice using QStandardPaths class instead:
Set the application name in, for example, main.cpp
int main(...)
{
[..]
a.setApplicationName("FlameTool");
}
Copy the file:
QString addin_path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
QDir dir(addin_path);
if (!dir.exists())
dir.mkpath(addin_path);
if (!dir.exists("addins"))
dir.mkdir("addins");
dir.cd("addins");
addin_path = dir.absoluteFilePath(id + ".limod");
if (QFile::exists(addin_path))
QFile::remove(addin_path);
if(QFile::copy(file_passed, addin_path))
qDebug("copied");
else
qDebug("not copied");
Please also note that:
Note that if a file with the name newName already exists, copy() returns false (i.e. QFile will not overwrite it).