Mercurial > minori
comparison include/core/filesystem.h @ 61:327568ad9be9
core/fs: finish class-ification of paths
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Fri, 29 Sep 2023 15:52:31 -0400 |
| parents | 327e9a5c72f1 |
| children | 3d2decf093bb |
comparison
equal
deleted
inserted
replaced
| 60:d417e9381ca5 | 61:327568ad9be9 |
|---|---|
| 2 #define __core__filesystem_h | 2 #define __core__filesystem_h |
| 3 #include <string> | 3 #include <string> |
| 4 | 4 |
| 5 namespace Filesystem { | 5 namespace Filesystem { |
| 6 | 6 |
| 7 bool CreateDirectories(const std::string& path); | 7 class Path { |
| 8 bool Exists(const std::string& path); | 8 public: |
| 9 std::string Basename(const std::string& path); | 9 Path(); |
| 10 std::string Stem(const std::string& path); | 10 Path(const std::string& path); |
| 11 std::string GetParentDirectory(const std::string& path); | 11 Path(const Path& path); |
| 12 std::string GetDotPath(); // %APPDATA%/minori, ~/Library/Application Support/minori, ~/.config/minori... | 12 bool CreateDirectories() const; |
| 13 std::string GetConfigPath(); // (dotpath)/config.json | 13 bool Exists() const; |
| 14 std::string GetAnimeDBPath(); // (dotpath)/anime/db.json | 14 std::string Basename() const; |
| 15 std::string Stem() const; | |
| 16 std::string Extension() const; | |
| 17 Path GetParent() const; | |
| 18 void SetPath(const std::string& path); | |
| 19 std::string GetPath() const; | |
| 20 | |
| 21 private: | |
| 22 std::string _path; | |
| 23 }; | |
| 24 | |
| 25 Path GetDotPath(); // %APPDATA%/minori, ~/Library/Application Support/minori, ~/.config/minori... | |
| 26 Path GetConfigPath(); // (dotpath)/config.json | |
| 27 Path GetAnimeDBPath(); // (dotpath)/anime/db.json | |
| 15 | 28 |
| 16 } // namespace Filesystem | 29 } // namespace Filesystem |
| 17 | 30 |
| 18 #endif // __core__filesystem_h | 31 #endif // __core__filesystem_h |
