From 5a857be1e4388eb2500fe476a283f3794ee86761 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 20 Aug 2020 17:56:57 +0200 Subject: Create meta file if it does not exist when trying to open it --- src/downloadmanager.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/downloadmanager.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index ce60c8e1..9e1b682b 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1097,21 +1097,25 @@ void DownloadManager::openMetaFile(int index) { return; } - auto path = QDir(m_OutputDirectory); - auto metaPath = getFilePath(index) + ".meta"; + const auto path = QDir(m_OutputDirectory); + const auto filePath = getFilePath(index); + const auto metaPath = filePath + ".meta"; + if (path.exists(metaPath)) { shell::Open(metaPath); return; } - - auto info = m_ActiveDownloads[index]; - info->m_FileInfo->repository = "Nexus"; + else { + QSettings metaFile(metaPath, QSettings::IniFormat); + metaFile.setValue("removed", false); + } if (path.exists(metaPath)) { shell::Open(metaPath); - } else { - shell::Explore(m_OutputDirectory); + return; } + + shell::Explore(filePath); } void DownloadManager::openInDownloadsFolder(int index) -- cgit v1.3.1