From 1285584e8964bc409e335128ba93a331ec48118b Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 8 Jan 2012 01:34:57 +0000 Subject: [PATCH] Add ?local for the user's local config dir; use it for FFMS2 indexes Originally committed to SVN as r6235. --- aegisub/src/ffmpegsource_common.cpp | 4 ++-- aegisub/src/main.cpp | 1 + aegisub/src/standard_paths.cpp | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/aegisub/src/ffmpegsource_common.cpp b/aegisub/src/ffmpegsource_common.cpp index f611dd46b..4e0b94ed9 100644 --- a/aegisub/src/ffmpegsource_common.cpp +++ b/aegisub/src/ffmpegsource_common.cpp @@ -227,7 +227,7 @@ wxString FFmpegSourceProvider::GetCacheFilename(const wxString& _filename) // Generate the filename unsigned int *md5 = (unsigned int*) digest; - wxString result = wxString::Format("?user/ffms2cache/%08X%08X%08X%08X.ffindex",md5[0],md5[1],md5[2],md5[3]); + wxString result = wxString::Format("?local/ffms2cache/%08X%08X%08X%08X.ffindex",md5[0],md5[1],md5[2],md5[3]); result = StandardPaths::DecodePath(result); // Ensure that folder exists @@ -284,7 +284,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() { return (wxThread::ExitCode)1; } - wxString cachedirname = StandardPaths::DecodePath("?user/ffms2cache/"); + wxString cachedirname = StandardPaths::DecodePath("?local/ffms2cache/"); wxDir cachedir; if (!cachedir.Open(cachedirname)) { LOG_D("provider/ffmpegsource/cache") << "couldn't open cache directory " << STD_STR(cachedirname); diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index 4b09e11ea..2e28b7605 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -184,6 +184,7 @@ bool AegisubApp::OnInit() { if (OPT_GET("App/Local Config")->GetBool()) { // Local config, make ?user mean ?data so all user settings are placed in install dir StandardPaths::SetPathValue("?user", StandardPaths::DecodePath("?data")); + StandardPaths::SetPathValue("?local", StandardPaths::DecodePath("?data")); config::opt->SetConfigPath(conf_local); } } catch (agi::acs::AcsError const&) { diff --git a/aegisub/src/standard_paths.cpp b/aegisub/src/standard_paths.cpp index bb00162f9..6ecc2d3a3 100644 --- a/aegisub/src/standard_paths.cpp +++ b/aegisub/src/standard_paths.cpp @@ -59,11 +59,14 @@ StandardPaths::StandardPaths() { DoSetPathValue("?data", paths.GetDataDir()); DoSetPathValue("?user", paths.GetUserDataDir()); + DoSetPathValue("?local", paths.GetUserLocalDataDir()); DoSetPathValue("?temp", paths.GetTempDir()); // Create paths if they don't exist - wxFileName folder(paths.GetUserDataDir() + "/"); - if (!folder.DirExists()) folder.Mkdir(0777,wxPATH_MKDIR_FULL); + if (!wxDirExists(paths.GetUserDataDir())) + wxMkDir(paths.GetUserDataDir(), 0777); + if (!wxDirExists(paths.GetUserLocalDataDir())) + wxMkDir(paths.GetUserLocalDataDir(), 0777); } wxString StandardPaths::DoDecodePath(wxString path) {