Skip to content
Snippets Groups Projects
Commit 74b456c3 authored by akiraohgaki's avatar akiraohgaki
Browse files

Code cleanup

parent 2177247f
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,6 @@ bool XdgUrl::isValid()
&& !filename.isEmpty()) {
return true;
}
return false;
}
......@@ -194,14 +193,8 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
{
QJsonObject result;
QString type = metadata_["type"].toString();
QString destination = destinations_[type].toString();
QString path = destination + "/" + metadata_["filename"].toString();
QString tempPath = qtlibs::Dir::tempPath() + "/" + metadata_["filename"].toString();
qtlibs::Dir(destination).make();
qtlibs::File(path).remove(); // Remove previous downloaded file
if (!resource->saveData(tempPath)) {
result["status"] = QString("error_save");
result["message"] = QString("Failed to save data as " + tempPath);
......@@ -211,6 +204,13 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
qtlibs::Package package(tempPath);
QString type = metadata_["type"].toString();
QString destination = destinations_[type].toString();
QString path = destination + "/" + metadata_["filename"].toString();
qtlibs::Dir(destination).make();
qtlibs::File(path).remove(); // Remove previous downloaded file
if (type == "bin"
&& package.installAsProgram(path)) {
result["message"] = QString("The file has been installed into " + destination);
......
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