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
Loading
...@@ -201,8 +201,6 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource) ...@@ -201,8 +201,6 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
return; return;
} }
qtlibs::Package package(tempPath);
QString type = metadata_["type"].toString(); QString type = metadata_["type"].toString();
QString destination = destinations_[type].toString(); QString destination = destinations_[type].toString();
QString path = destination + "/" + metadata_["filename"].toString(); QString path = destination + "/" + metadata_["filename"].toString();
...@@ -210,6 +208,9 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource) ...@@ -210,6 +208,9 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
qtlibs::Dir(destination).make(); qtlibs::Dir(destination).make();
qtlibs::File(path).remove(); // Remove previous downloaded file qtlibs::File(path).remove(); // Remove previous downloaded file
qtlibs::File tempFile(tempPath);
qtlibs::Package package(tempPath);
if (type == "bin" if (type == "bin"
&& package.installAsProgram(path)) { && package.installAsProgram(path)) {
result["message"] = QString("The file has been installed into " + destination); result["message"] = QString("The file has been installed into " + destination);
...@@ -245,12 +246,15 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource) ...@@ -245,12 +246,15 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
result["message"] = QString("The file has been installed into " + destination); result["message"] = QString("The file has been installed into " + destination);
} }
else { else {
tempFile.remove();
result["status"] = QString("error_install"); result["status"] = QString("error_install");
result["message"] = QString("Failed to installation"); result["message"] = QString("Failed to installation");
emit error(result); emit error(result);
return; return;
} }
tempFile.remove();
destination_ = destination; destination_ = destination;
result["status"] = QString("success_install"); 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