Mercurial > minori
diff src/track/media.cc @ 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 | 28842a8d0c6b |
line wrap: on
line diff
--- a/src/track/media.cc Thu Nov 09 13:53:04 2023 -0500 +++ b/src/track/media.cc Thu Nov 09 18:01:56 2023 -0500 @@ -13,9 +13,9 @@ namespace Track { namespace Media { -std::vector<Filesystem::Path> GetCurrentlyPlayingFiles() { +std::vector<std::filesystem::path> GetCurrentlyPlayingFiles() { /* getting all open files */ - std::vector<Filesystem::Path> ret; + std::vector<std::filesystem::path> ret; std::vector<int> pids = Animia::get_all_pids(); for (int pid : pids) { @@ -24,10 +24,10 @@ continue; for (const std::string& file : Animia::filter_system_files(Animia::get_open_files(pid))) { - const Filesystem::Path path(file); + const std::filesystem::path path(file); for (const Types::MediaExtension& ext : session.recognition.extensions) - if (path.Extension() == ext.GetExtension()) + if (path.extension() == ext.GetExtension()) ret.push_back(path); } } @@ -36,12 +36,12 @@ return ret; } -Filesystem::Path GetCurrentPlaying() { +std::filesystem::path GetCurrentPlaying() { /* getting all open files */ - std::vector<Filesystem::Path> paths = GetCurrentlyPlayingFiles(); + std::vector<std::filesystem::path> paths = GetCurrentlyPlayingFiles(); if (paths.size()) return paths.at(0); - return Filesystem::Path(); + return std::filesystem::path(); } std::unordered_map<std::string, std::string> GetMapFromElements(const anitomy::Elements& elements) { @@ -59,16 +59,16 @@ return ret; } -std::unordered_map<std::string, std::string> GetFileElements(std::string basename) { +std::unordered_map<std::string, std::string> GetFileElements(const std::string& basename) { anitomy::Anitomy anitomy; anitomy.Parse(Strings::ToWstring(basename)); return GetMapFromElements(anitomy.elements()); } -std::unordered_map<std::string, std::string> GetFileElements(Filesystem::Path path) { +std::unordered_map<std::string, std::string> GetFileElements(const std::filesystem::path& path) { anitomy::Anitomy anitomy; - anitomy.Parse(Strings::ToWstring(path.Basename())); + anitomy.Parse(path.filename().wstring()); return GetMapFromElements(anitomy.elements()); }