Mercurial > minori
diff 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 |
line wrap: on
line diff
--- a/include/core/filesystem.h Thu Nov 09 13:53:04 2023 -0500 +++ b/include/core/filesystem.h Thu Nov 09 18:01:56 2023 -0500 @@ -1,32 +1,16 @@ #ifndef __core__filesystem_h #define __core__filesystem_h #include <string> +#include <filesystem> namespace Filesystem { -class Path { - public: - Path(); - Path(const std::string& path); - Path(const Path& path); - bool CreateDirectories() const; - bool Exists() const; - std::string Basename() const; - std::string Stem() const; - std::string Extension() const; - Path GetParent() const; - void SetPath(const std::string& path); - std::string GetPath() const; - - private: - std::string _path; -}; - -Path GetDotPath(); // %APPDATA%/minori, ~/Library/Application Support/minori, ~/.config/minori... -Path GetConfigPath(); // (dotpath)/config.json -Path GetAnimeDBPath(); // (dotpath)/anime/db.json -Path GetPlayersPath(); // (dotpath)/player.json -Path GetExtensionsPath(); // (dotpath)/extensions.json +void CreateDirectories(const std::filesystem::path& path); +std::filesystem::path GetDotPath(); // %APPDATA%/minori, ~/Library/Application Support/minori, ~/.config/minori... +std::filesystem::path GetConfigPath(); // (dotpath)/config.json +std::filesystem::path GetAnimeDBPath(); // (dotpath)/anime/db.json +std::filesystem::path GetPlayersPath(); // (dotpath)/player.json +std::filesystem::path GetExtensionsPath(); // (dotpath)/extensions.json } // namespace Filesystem