This commit is contained in:
halx99 2020-08-28 11:04:14 +08:00
parent 14731e7a5a
commit e75a29a393
1 changed files with 8 additions and 7 deletions

View File

@ -1405,11 +1405,13 @@ std::vector<std::string> FileUtils::listFiles(const std::string& dirPath) const
} }
std::string filepath = file.path; std::string filepath = file.path;
if (file.is_dir) if(strcmp(file.name, ".") != 0 && strcmp(file.name, "..") != 0)
{ {
if (file.is_dir)
filepath.push_back('/'); filepath.push_back('/');
files.push_back(std::move(filepath));
} }
files.push_back(filepath);
if (tinydir_next(&dir) == -1) if (tinydir_next(&dir) == -1)
{ {
@ -1441,9 +1443,8 @@ void FileUtils::listFilesRecursively(const std::string& dirPath, std::vector<std
// Error getting file // Error getting file
break; break;
} }
std::string fileName = file.name;
if (fileName != "." && fileName != "..") if(strcmp(file.name, ".") != 0 && strcmp(file.name, "..") != 0)
{ {
std::string filepath = file.path; std::string filepath = file.path;
if (file.is_dir) if (file.is_dir)
@ -1454,7 +1455,7 @@ void FileUtils::listFilesRecursively(const std::string& dirPath, std::vector<std
} }
else else
{ {
files->push_back(filepath); files->push_back(std::move(filepath));
} }
} }