From e75a29a3932dfaf83be0e9d3cb62b7f3feb5bbf8 Mon Sep 17 00:00:00 2001 From: halx99 Date: Fri, 28 Aug 2020 11:04:14 +0800 Subject: [PATCH] fix #179 --- cocos/platform/CCFileUtils.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp index b3a5b52e62..6362dccccc 100644 --- a/cocos/platform/CCFileUtils.cpp +++ b/cocos/platform/CCFileUtils.cpp @@ -1405,11 +1405,13 @@ std::vector FileUtils::listFiles(const std::string& dirPath) const } std::string filepath = file.path; - if (file.is_dir) + if(strcmp(file.name, ".") != 0 && strcmp(file.name, "..") != 0) { - filepath.push_back('/'); + if (file.is_dir) + filepath.push_back('/'); + + files.push_back(std::move(filepath)); } - files.push_back(filepath); if (tinydir_next(&dir) == -1) { @@ -1441,9 +1443,8 @@ void FileUtils::listFilesRecursively(const std::string& dirPath, std::vectorpush_back(filepath); + files->push_back(std::move(filepath)); } }