From 89542075c2eaecdc0ee3b290f101b6c7ddbf732d Mon Sep 17 00:00:00 2001
From: Akira Ohgaki <akiraohgaki@gmail.com>
Date: Mon, 14 Nov 2016 10:10:54 +0900
Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20remove=20previous=20downloaded?=
 =?UTF-8?q?=20file?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/handlers/xdgurl.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/app/handlers/xdgurl.cpp b/src/app/handlers/xdgurl.cpp
index 6e66c55..da90bdb 100644
--- a/src/app/handlers/xdgurl.cpp
+++ b/src/app/handlers/xdgurl.cpp
@@ -172,7 +172,6 @@ void XdgUrl::saveDownloadedFile(qtlibs::NetworkResource *resource)
     QString path = destination + "/" + metadata_["filename"].toString();
 
     qtlibs::Dir(destination).make();
-    qtlibs::File(path).remove(); // Remove previous downloaded file
 
     if (!resource->saveData(path)) {
         result["status"] = QString("error_save");
@@ -201,15 +200,14 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
         return;
     }
 
+    qtlibs::Package package(tempPath);
+    qtlibs::File tempFile(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
-
-    qtlibs::File tempFile(tempPath);
-    qtlibs::Package package(tempPath);
 
     if (type == "bin"
             && package.installAsProgram(path)) {
-- 
GitLab