Skip to content
Snippets Groups Projects
Commit 45a70974 authored by akiraohgaki's avatar akiraohgaki
Browse files

Remove temporally file

parent b67a8f54
No related branches found
No related tags found
No related merge requests found
......@@ -201,8 +201,6 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
return;
}
qtlibs::Package package(tempPath);
QString type = metadata_["type"].toString();
QString destination = destinations_[type].toString();
QString path = destination + "/" + metadata_["filename"].toString();
......@@ -210,6 +208,9 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
qtlibs::Dir(destination).make();
qtlibs::File(path).remove(); // Remove previous downloaded file
qtlibs::File tempFile(tempPath);
qtlibs::Package package(tempPath);
if (type == "bin"
&& package.installAsProgram(path)) {
result["message"] = QString("The file has been installed into " + destination);
......@@ -245,12 +246,15 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
result["message"] = QString("The file has been installed into " + destination);
}
else {
tempFile.remove();
result["status"] = QString("error_install");
result["message"] = QString("Failed to installation");
emit error(result);
return;
}
tempFile.remove();
destination_ = destination;
result["status"] = QString("success_install");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment