Skip to content

Commit

Permalink
ref #544 dir sort elements for all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelson-numerical-software committed Dec 29, 2021
1 parent 45a7af4 commit f878848
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/files_folders_functions/src/cpp/ListFiles.cpp
Expand Up @@ -198,22 +198,22 @@ ListFiles(const std::wstring& directory, bool bSubdirectories)
bool
operator()(FileInfo a, FileInfo b) // lgtm [cpp/large-parameter]
{
return a.getName() < b.getName();
return static_cast<int>(a.isDir()) > static_cast<int>(b.isDir());
}
} customFilenameLess;
} customIsDirLess;
if (!res.empty()) {
std::sort(res.begin(), res.end(), customFilenameLess);
std::sort(res.begin(), res.end(), customIsDirLess);
}
struct
{
bool
operator()(FileInfo a, FileInfo b) // lgtm [cpp/large-parameter]
{
return static_cast<int>(a.isDir()) > static_cast<int>(b.isDir());
return a.getName() < b.getName();
}
} customIsDirLess;
} customFilenameLess;
if (!res.empty()) {
std::sort(res.begin(), res.end(), customIsDirLess);
std::sort(res.begin(), res.end(), customFilenameLess);
}
}
return res;
Expand Down

0 comments on commit f878848

Please sign in to comment.