Mercurial > minori
comparison include/core/filesystem.h @ 135:0a458cb26ff4
filesystem: move to using std::filesystem after C++17 switch
old compilers will croak compiling this, but it's not like we
*really* need to support them (they probably croak compiling
Qt as well)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Thu, 09 Nov 2023 18:01:56 -0500 |
parents | 39521c47c7a3 |
children | 2f5a9247e501 |
comparison
equal
deleted
inserted
replaced
134:54c9d36207db | 135:0a458cb26ff4 |
---|---|
1 #ifndef __core__filesystem_h | 1 #ifndef __core__filesystem_h |
2 #define __core__filesystem_h | 2 #define __core__filesystem_h |
3 #include <string> | 3 #include <string> |
4 #include <filesystem> | |
4 | 5 |
5 namespace Filesystem { | 6 namespace Filesystem { |
6 | 7 |
7 class Path { | 8 void CreateDirectories(const std::filesystem::path& path); |
8 public: | 9 std::filesystem::path GetDotPath(); // %APPDATA%/minori, ~/Library/Application Support/minori, ~/.config/minori... |
9 Path(); | 10 std::filesystem::path GetConfigPath(); // (dotpath)/config.json |
10 Path(const std::string& path); | 11 std::filesystem::path GetAnimeDBPath(); // (dotpath)/anime/db.json |
11 Path(const Path& path); | 12 std::filesystem::path GetPlayersPath(); // (dotpath)/player.json |
12 bool CreateDirectories() const; | 13 std::filesystem::path GetExtensionsPath(); // (dotpath)/extensions.json |
13 bool Exists() const; | |
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 | |
28 Path GetPlayersPath(); // (dotpath)/player.json | |
29 Path GetExtensionsPath(); // (dotpath)/extensions.json | |
30 | 14 |
31 } // namespace Filesystem | 15 } // namespace Filesystem |
32 | 16 |
33 #endif // __core__filesystem_h | 17 #endif // __core__filesystem_h |