Common/FileUtil: Strip trailing path separator in ScanDirectoryTree().
This commit is contained in:
parent
ee863e6722
commit
f76aaf65f6
|
@ -483,8 +483,16 @@ bool CreateEmptyFile(const std::string& filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursive or non-recursive list of files and directories under directory.
|
// Recursive or non-recursive list of files and directories under directory.
|
||||||
FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
|
FSTEntry ScanDirectoryTree(std::string directory, bool recursive)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (!directory.empty() && (directory.back() == '/' || directory.back() == '\\'))
|
||||||
|
directory.pop_back();
|
||||||
|
#else
|
||||||
|
if (!directory.empty() && directory.back() == '/')
|
||||||
|
directory.pop_back();
|
||||||
|
#endif
|
||||||
|
|
||||||
INFO_LOG_FMT(COMMON, "ScanDirectoryTree: directory {}", directory);
|
INFO_LOG_FMT(COMMON, "ScanDirectoryTree: directory {}", directory);
|
||||||
FSTEntry parent_entry;
|
FSTEntry parent_entry;
|
||||||
parent_entry.physicalName = directory;
|
parent_entry.physicalName = directory;
|
||||||
|
|
|
@ -176,7 +176,7 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename);
|
||||||
bool CreateEmptyFile(const std::string& filename);
|
bool CreateEmptyFile(const std::string& filename);
|
||||||
|
|
||||||
// Recursive or non-recursive list of files and directories under directory.
|
// Recursive or non-recursive list of files and directories under directory.
|
||||||
FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive);
|
FSTEntry ScanDirectoryTree(std::string directory, bool recursive);
|
||||||
|
|
||||||
// deletes the given directory and anything under it. Returns true on success.
|
// deletes the given directory and anything under it. Returns true on success.
|
||||||
bool DeleteDirRecursively(const std::string& directory);
|
bool DeleteDirRecursively(const std::string& directory);
|
||||||
|
|
Loading…
Reference in New Issue