timeline refactor, bit broken rn

This commit is contained in:
2025-11-09 10:35:21 -05:00
parent 1e35910b0a
commit e2799b1e58
41 changed files with 2034 additions and 1374 deletions

View File

@@ -8,14 +8,37 @@
namespace anm2ed::util::filesystem
{
std::string path_preferences_get()
std::string path_pref_get(const char* org, const char* app)
{
char* preferencesPath = SDL_GetPrefPath("", "anm2ed");
std::string preferencesPathString = preferencesPath;
SDL_free(preferencesPath);
return preferencesPathString;
auto path = SDL_GetPrefPath(org, app);
std::string string = path;
SDL_free(path);
return string;
}
std::string path_preferences_get() { return path_pref_get(nullptr, "anm2ed"); }
std::string path_base_get() { return std::string(SDL_GetBasePath()); }
std::string path_executable_get() { return std::filesystem::path(path_base_get()) / "anm2ed"; }
#ifdef __unix__
std::string path_application_get()
{
return std::filesystem::path(path_pref_get(nullptr, "applications")) / "anm2ed.desktop";
}
std::string path_mime_get()
{
return std::filesystem::path(path_pref_get(nullptr, "mime/application")) / "x-anm2+xml.xml";
}
std::string path_icon_get() { return std::filesystem::path(path_preferences_get()) / "anm2ed.png"; }
std::string path_icon_file_get()
{
return std::filesystem::path(path_preferences_get()) / "application-x-anm2+xml.png";
}
#endif
bool path_is_exist(const std::string& path)
{
std::error_code errorCode;
@@ -49,8 +72,5 @@ namespace anm2ed::util::filesystem
std::filesystem::current_path(path);
}
WorkingDirectory::~WorkingDirectory()
{
std::filesystem::current_path(previous);
}
WorkingDirectory::~WorkingDirectory() { std::filesystem::current_path(previous); }
}

View File

@@ -5,9 +5,21 @@
namespace anm2ed::util::filesystem
{
#ifdef __unix__
std::string path_application_get();
std::string path_mime_get();
std::string path_icon_get();
std::string path_icon_file_get();
#endif
std::string path_pref_get();
std::string path_preferences_get();
std::string path_base_get();
std::string path_executable_get();
bool path_is_exist(const std::string&);
bool path_is_extension(const std::string&, const std::string&);
std::filesystem::path path_lower_case_backslash_handle(std::filesystem::path&);
class WorkingDirectory