Mercurial > minori
diff src/core/filesystem.cc @ 161:71752dcbb49f
junk: clunky merge commit
maybe I should enable rebase on this repo
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Fri, 17 Nov 2023 13:09:20 -0500 |
parents | 80d6b28eb29f |
children | 121c2d5b321f |
line wrap: on
line diff
--- a/src/core/filesystem.cc Fri Nov 17 12:37:31 2023 -0500 +++ b/src/core/filesystem.cc Fri Nov 17 13:09:20 2023 -0500 @@ -27,7 +27,12 @@ /* this runs fs::create_directories() on the PARENT directory. */ void CreateDirectories(const std::filesystem::path& path) { - std::filesystem::create_directories(path.parent_path()); + if (path.empty()) + return; + + const auto& parent = path.parent_path(); + if (!std::filesystem::exists(parent)) + std::filesystem::create_directories(parent); } std::filesystem::path GetDotPath() { @@ -49,8 +54,8 @@ if (!home) home = getpwuid(getuid())->pw_dir; # endif // __linux__ - if (!home) - return std::filesystem::path(home) / ".config"; + if (home) + return std::filesystem::path(home) / ".config" / CONFIG_DIR; else return std::filesystem::path(); #endif // !WIN32 && !MACOSX