From 2bbaac3157a72572a148b74b4d84d79db627f83c Mon Sep 17 00:00:00 2001 From: zv0n Date: Sun, 27 Feb 2022 13:52:05 +0100 Subject: [PATCH] Fix dir-only addFilesRecursive --- functions.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/functions.cpp b/functions.cpp index e067a14..fccc2ab 100644 --- a/functions.cpp +++ b/functions.cpp @@ -60,22 +60,22 @@ void closeLibraries( std::vector< RenameLibrary > &libraries ) { void addFilesRecursive(const FileObject &parent, std::vector< FileObject > &results, const std::string &filename, const std::string &containing_directory, bool dir_only = false ) { auto path = containing_directory + FSLib::dir_divisor + filename; - FileObject fo{}; if(!dir_only || FSLib::isDirectory(path)) { + FileObject fo{}; if(!parent.getPath().empty()) { fo.setPath(parent.getPath() + FSLib::dir_divisor + filename); } else { fo.setPath(filename); } fo.setDepth(parent.getDepth() + 1); - } - if( FSLib::isDirectory(path) ) { - fo.setFileType(TYPE_DIRECTORY); - for(const auto &entry : FSLib::Directory(path)) { - addFilesRecursive(fo, results, entry, path, dir_only); + if( FSLib::isDirectory(path) ) { + fo.setFileType(TYPE_DIRECTORY); + for(const auto &entry : FSLib::Directory(path)) { + addFilesRecursive(fo, results, entry, path, dir_only); + } } + results.push_back(std::move(fo)); } - results.push_back(std::move(fo)); } std::vector< FileObject > getFilesInSource( const std::string &source_dir ) {