diff --git a/interfaces/kits/js/src/mod_fs/properties/listfile.cpp b/interfaces/kits/js/src/mod_fs/properties/listfile.cpp index 01fe6bb1543abfcc6d463f5a698b93734bb0aaa7..19366d2e37333fc3c57940d2238e1c3f4f41b432 100644 --- a/interfaces/kits/js/src/mod_fs/properties/listfile.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/listfile.cpp @@ -270,8 +270,10 @@ static void RecursiveFunc(const string &path, vector &dirents) dirents.emplace_back(tmpDirent); } } else if ((*(namelist)[i]).d_type == DT_DIR) { + string pathTemp = g_optionArgs.path; g_optionArgs.path += '/' + string((*namelist[i]).d_name); RecursiveFunc(g_optionArgs.path, dirents); + g_optionArgs.path = pathTemp; } free(namelist[i]); }