Mercurial > minori
comparison include/core/filesystem.h @ 404:e561b7542b7b
*: fix build on mac os x
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 19 Jan 2026 20:50:40 -0500 |
| parents | 963047512d34 |
| children |
comparison
equal
deleted
inserted
replaced
| 403:df4a027623d0 | 404:e561b7542b7b |
|---|---|
| 1 #ifndef MINORI_CORE_FILESYSTEM_H_ | 1 #ifndef MINORI_CORE_FILESYSTEM_H_ |
| 2 #define MINORI_CORE_FILESYSTEM_H_ | 2 #define MINORI_CORE_FILESYSTEM_H_ |
| 3 #include <filesystem> | 3 #include <filesystem> |
| 4 #include <functional> | 4 #include <functional> |
| 5 #include <string> | 5 #include <string> |
| 6 #include <unordered_map> | |
| 6 | 7 |
| 7 namespace Filesystem { | 8 namespace Filesystem { |
| 8 | 9 |
| 9 void CreateDirectories(const std::filesystem::path &path); | 10 void CreateDirectories(const std::filesystem::path &path); |
| 10 std::filesystem::path GetDotPath(); // %APPDATA%/minori/, ~/Library/Application Support/minori/, ~/.config/minori/... | 11 std::filesystem::path GetDotPath(); // %APPDATA%/minori/, ~/Library/Application Support/minori/, ~/.config/minori/... |
| 11 std::filesystem::path GetConfigPath(); // (dotpath)/config.json | 12 std::filesystem::path GetConfigPath(); // (dotpath)/config.json |
| 12 std::filesystem::path GetAnimeDBPath(); // (dotpath)/anime/db.json | 13 std::filesystem::path GetAnimeDBPath(); // (dotpath)/anime/db.json |
| 13 std::filesystem::path GetTorrentsPath(); // (dotpath)/torrents/... | 14 std::filesystem::path GetTorrentsPath(); // (dotpath)/torrents/... |
| 14 std::filesystem::path GetAnimePostersPath(); // (dotpath)/anime/posters/ | 15 std::filesystem::path GetAnimePostersPath(); // (dotpath)/anime/posters/ |
| 16 | |
| 17 struct PathHash { | |
| 18 auto operator()(const std::filesystem::path &p) const noexcept { | |
| 19 return std::filesystem::hash_value(p); | |
| 20 } | |
| 21 }; | |
| 22 | |
| 23 template<typename T> | |
| 24 using PathMap = std::unordered_map<std::filesystem::path, T, PathHash>; | |
| 15 | 25 |
| 16 /* ------------------------------------------------------------------------ */ | 26 /* ------------------------------------------------------------------------ */ |
| 17 /* Filesystem watcher interface. This is implemented differently on | 27 /* Filesystem watcher interface. This is implemented differently on |
| 18 * different platforms :) */ | 28 * different platforms :) */ |
| 19 | 29 |
