From ec1219acdafb285a8918247e7c7928bcc2d5f187 Mon Sep 17 00:00:00 2001 From: Albert S Date: Mon, 29 Apr 2019 10:24:50 +0200 Subject: [PATCH] cli: commanddelete: fix broken dry-run --- cli/commanddelete.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cli/commanddelete.cpp b/cli/commanddelete.cpp index f40100c..4fbb0ec 100644 --- a/cli/commanddelete.cpp +++ b/cli/commanddelete.cpp @@ -17,34 +17,34 @@ int CommandDelete::removeNonExistent(bool verbose, bool dryRun, QString pattern) { for(FileData &file : files) { - if(!dryRun) - { QFileInfo fileInfo(file.absPath); if(!fileInfo.exists()) { - if(this->dbService->deleteFile(file.absPath)) + if(!dryRun) { - if(verbose) + if(this->dbService->deleteFile(file.absPath)) { - Logger::info() << "Deleted" << file.absPath << endl; + if(verbose) + { + Logger::info() << "Deleted" << file.absPath << endl; + } + } + else + { + Logger::error()<< "Failed to delete:" << file.absPath << ", exiting." << endl + ; + return 1; } } else { - Logger::error()<< "Failed to delete:" << file.absPath << ", exiting." << endl - ; - return 1; + Logger::info() << "Would delete " << file.absPath << endl; } } - } - else - { - Logger::info() << "Would delete " << file.absPath << endl; - } - } + offset += limit; - processedRows = this->dbService->getFiles(files, pattern, 0, limit); + processedRows = this->dbService->getFiles(files, pattern, offset, limit); } return 0; }