fix comment

This commit is contained in:
gabime 2024-12-06 12:27:31 +02:00
parent 9f4492da61
commit 4e25b0829a

View File

@ -42,7 +42,6 @@ bool path_exists(const filename_t &filename) noexcept { return std::filesystem::
// "abc///" => "abc//" // "abc///" => "abc//"
filename_t dir_name(const filename_t &path) { return path.parent_path(); } filename_t dir_name(const filename_t &path) { return path.parent_path(); }
// Create the given directory - and all directories leading to it // Create the given directory - and all directories leading to it
// return true on success or if the directory already exists // return true on success or if the directory already exists
bool create_dir(const filename_t &path) { bool create_dir(const filename_t &path) {
@ -50,19 +49,13 @@ bool create_dir(const filename_t &path) {
return std::filesystem::create_directories(path, ec) || !ec; return std::filesystem::create_directories(path, ec) || !ec;
} }
// Return file path and its extension: // Return file path and its extension:
// //
// "mylog.txt" => ("mylog", ".txt") // "mylog.txt" => ("mylog", ".txt")
// "mylog" => ("mylog", "") // "mylog" => ("mylog", "")
// "mylog." => ("mylog", ".") // "mylog." => ("mylog", ".")
// "/dir1/dir2/mylog.txt" => ("/dir1/dir2/mylog", ".txt") // "/dir1/dir2/mylog.txt" => ("/dir1/dir2/mylog", ".txt")
// // ".mylog" => (".mylog", "")
// the starting dot in filenames is ignored (hidden files):
//
// ".mylog" => (".mylog". "")
// "my_folder/.mylog" => ("my_folder/.mylog", "")
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
std::tuple<filename_t, filename_t> split_by_extension(const filename_t &fname) { std::tuple<filename_t, filename_t> split_by_extension(const filename_t &fname) {
const auto ext = fname.extension(); const auto ext = fname.extension();
auto without_ext = filename_t(fname).replace_extension(); auto without_ext = filename_t(fname).replace_extension();