Add ?local for the user's local config dir; use it for FFMS2 indexes

Originally committed to SVN as r6235.
This commit is contained in:
Thomas Goyne 2012-01-08 01:34:57 +00:00
parent 44bc249fe8
commit 1285584e89
3 changed files with 8 additions and 4 deletions

View file

@ -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);

View file

@ -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&) {

View file

@ -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) {