Mercurial > minori
annotate 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 |
rev | line source |
---|---|
9 | 1 #ifndef __core__filesystem_h |
2 #define __core__filesystem_h | |
11 | 3 #include <string> |
4 | |
5 namespace Filesystem { | |
6 | |
61
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
7 class Path { |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
8 public: |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
9 Path(); |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
10 Path(const std::string& path); |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
11 Path(const Path& path); |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
12 bool CreateDirectories() const; |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
13 bool Exists() const; |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
14 std::string Basename() const; |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
15 std::string Stem() const; |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
16 std::string Extension() const; |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
17 Path GetParent() const; |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
18 void SetPath(const std::string& path); |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
19 std::string GetPath() const; |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
20 |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
21 private: |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
22 std::string _path; |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
23 }; |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
24 |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
25 Path GetDotPath(); // %APPDATA%/minori, ~/Library/Application Support/minori, ~/.config/minori... |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
26 Path GetConfigPath(); // (dotpath)/config.json |
327568ad9be9
core/fs: finish class-ification of paths
Paper <mrpapersonic@gmail.com>
parents:
59
diff
changeset
|
27 Path GetAnimeDBPath(); // (dotpath)/anime/db.json |
11 | 28 |
36 | 29 } // namespace Filesystem |
11 | 30 |
31 #endif // __core__filesystem_h |