|
|
@ -255,13 +255,14 @@ static int listdir_recursive_impl (std::string prefix, std::string path,
|
|
|
|
std::string path_file = path + *file;
|
|
|
|
std::string path_file = path + *file;
|
|
|
|
if (Filesystem::isdir(prefixed_file))
|
|
|
|
if (Filesystem::isdir(prefixed_file))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
files.insert(std::pair<std::string, bool>(include_prefix ? prefixed_file : path_file, true));
|
|
|
|
|
|
|
|
|
|
|
|
if (depth == 0)
|
|
|
|
if (depth == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
out_of_depth = true;
|
|
|
|
out_of_depth = true;
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
files.insert(std::pair<std::string, bool>(include_prefix ? prefixed_file : path_file, true));
|
|
|
|
|
|
|
|
err = listdir_recursive_impl(prefix, path_file + "/", files, depth - 1, include_prefix);
|
|
|
|
err = listdir_recursive_impl(prefix, path_file + "/", files, depth - 1, include_prefix);
|
|
|
|
if (err)
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
@ -277,5 +278,7 @@ static int listdir_recursive_impl (std::string prefix, std::string path,
|
|
|
|
int Filesystem::listdir_recursive (std::string dir, std::map<std::string, bool> &files,
|
|
|
|
int Filesystem::listdir_recursive (std::string dir, std::map<std::string, bool> &files,
|
|
|
|
int depth /* = 10 */, bool include_prefix /* = true */)
|
|
|
|
int depth /* = 10 */, bool include_prefix /* = true */)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dir.size() && dir[dir.size()-1] == '/')
|
|
|
|
|
|
|
|
dir.resize(dir.size()-1);
|
|
|
|
return listdir_recursive_impl(dir, "", files, depth, include_prefix);
|
|
|
|
return listdir_recursive_impl(dir, "", files, depth, include_prefix);
|
|
|
|
}
|
|
|
|
}
|
|
|
|