Mercurial > minori
comparison src/core/filesystem.cc @ 369:47c9f8502269
*: clang-format all the things
I've edited the formatting a bit. Now pointer asterisks (and reference
ampersands) are on the variable instead of the type, as well as having
newlines for function braces (but nothing else)
| author | Paper <paper@tflc.us> |
|---|---|
| date | Fri, 25 Jul 2025 10:16:02 -0400 |
| parents | 862d0d8619f6 |
| children | 5912dafc6e28 |
comparison
equal
deleted
inserted
replaced
| 368:6d37a998cf91 | 369:47c9f8502269 |
|---|---|
| 8 | 8 |
| 9 namespace Filesystem { | 9 namespace Filesystem { |
| 10 | 10 |
| 11 /* this runs fs::create_directories() on the | 11 /* this runs fs::create_directories() on the |
| 12 PARENT directory. */ | 12 PARENT directory. */ |
| 13 void CreateDirectories(const std::filesystem::path& path) { | 13 void CreateDirectories(const std::filesystem::path &path) |
| 14 { | |
| 14 if (path.empty()) | 15 if (path.empty()) |
| 15 return; | 16 return; |
| 16 | 17 |
| 17 const auto& parent = path.parent_path(); | 18 const auto &parent = path.parent_path(); |
| 18 if (!std::filesystem::exists(parent)) | 19 if (!std::filesystem::exists(parent)) |
| 19 std::filesystem::create_directories(parent); | 20 std::filesystem::create_directories(parent); |
| 20 } | 21 } |
| 21 | 22 |
| 22 std::filesystem::path GetDotPath() { | 23 std::filesystem::path GetDotPath() |
| 24 { | |
| 23 /* | 25 /* |
| 24 * Windows: ~/AppData/Roaming/Minori | 26 * Windows: ~/AppData/Roaming/Minori |
| 25 * macOS: ~/Library/Application Support/Minori | 27 * macOS: ~/Library/Application Support/Minori |
| 26 * ...: ~/.config/minori | 28 * ...: ~/.config/minori |
| 27 * | 29 * |
| 32 #else | 34 #else |
| 33 return Strings::ToUtf8String(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)); | 35 return Strings::ToUtf8String(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)); |
| 34 #endif | 36 #endif |
| 35 } | 37 } |
| 36 | 38 |
| 37 std::filesystem::path GetConfigPath() { | 39 std::filesystem::path GetConfigPath() |
| 40 { | |
| 38 return GetDotPath() / CONFIG_NAME; | 41 return GetDotPath() / CONFIG_NAME; |
| 39 } | 42 } |
| 40 | 43 |
| 41 std::filesystem::path GetAnimeDBPath() { | 44 std::filesystem::path GetAnimeDBPath() |
| 45 { | |
| 42 return GetDotPath() / "anime" / "db.json"; | 46 return GetDotPath() / "anime" / "db.json"; |
| 43 } | 47 } |
| 44 | 48 |
| 45 std::filesystem::path GetTorrentsPath() { | 49 std::filesystem::path GetTorrentsPath() |
| 50 { | |
| 46 return GetDotPath() / "torrents"; | 51 return GetDotPath() / "torrents"; |
| 47 } | 52 } |
| 48 | 53 |
| 49 } // namespace Filesystem | 54 } // namespace Filesystem |
