From 05606dd5024d3b1db4f2ade809f9a45e4cbb81a0 Mon Sep 17 00:00:00 2001 From: Albert S Date: Thu, 2 Jun 2022 09:05:49 +0200 Subject: [PATCH] cli: CommandUpdate: When path is a dir, don't do anything (no deletion or updates) --- cli/commandupdate.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/cli/commandupdate.cpp b/cli/commandupdate.cpp index f242eb5..d31d380 100644 --- a/cli/commandupdate.cpp +++ b/cli/commandupdate.cpp @@ -53,17 +53,20 @@ int CommandUpdate::handle(QStringList arguments) for(FileData &fileData : files) { QFileInfo fileInfo(fileData.absPath); - if(fileInfo.exists() && fileInfo.isFile()) + if(fileInfo.exists()) { - if(fileInfo.lastModified().toSecsSinceEpoch() != fileData.mtime) + if(fileInfo.isFile()) { - if(!dryRun) + if(fileInfo.lastModified().toSecsSinceEpoch() != fileData.mtime) { - filePathsToUpdate.append(fileData.absPath); - } - else - { - Logger::info() << "Would update" << fileData.absPath << Qt::endl; + if(!dryRun) + { + filePathsToUpdate.append(fileData.absPath); + } + else + { + Logger::info() << "Would update" << fileData.absPath << Qt::endl; + } } } }