mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 10:29:02 +08:00
updated os::dir_name and tests
This commit is contained in:
@@ -519,7 +519,11 @@ SPDLOG_INLINE bool create_dir(filename_t path)
|
||||
// "abc" => ""
|
||||
// "abc///" => "abc//"
|
||||
SPDLOG_INLINE filename_t dir_name(filename_t path)
|
||||
{
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// support forward slash in windows
|
||||
std::replace(path.begin(), path.end(), '/', folder_sep);
|
||||
#endif
|
||||
auto pos = path.find_last_of(folder_sep);
|
||||
return pos != filename_t::npos ? path.substr(0, pos) : filename_t{};
|
||||
}
|
||||
|
Reference in New Issue
Block a user