1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Bug 1577 - Application configuration file location incorrect on Linux/case-sensitive Macs

On windows the capitalisation does not matter.
On Mac/Windows we use 'audacity' in path names, even if the directories wxWidgets suggests have 'Audacity'.
This commit is contained in:
James Crook
2017-01-25 19:52:40 +00:00
parent a05d039055
commit 53c3adfbe7
4 changed files with 35 additions and 19 deletions

View File

@@ -84,6 +84,21 @@ wxString FileNames::AutoSaveDir()
return FileNames::MkDir(autoSaveDir.GetFullPath());
}
// The APP name has upercase first letter (so that Quit Audacity is correctly
// capitalised on Mac, but we want lower case APP name in paths.
// This function does that substitution, IF the last component of
// the path is 'Audacity'.
wxString FileNames::LowerCaseAppNameInPath( const wxString & dirIn){
wxString dir = dirIn;
// BUG 1577 Capitalisation of Audacity in path...
if( dir.EndsWith( "Audacity" ) )
{
int nChars = dir.Length() - wxString( "Audacity" ).Length();
dir = dir.Left( nChars ) + "audacity";
}
return dir;
}
wxString FileNames::DataDir()
{
// LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict
@@ -112,20 +127,21 @@ wxString FileNames::DataDir()
} else
{
// Use OS-provided user data dir folder
wxString dataDir;
wxString dataDir( LowerCaseAppNameInPath( wxStandardPaths::Get().GetUserDataDir() ));
#if defined( __WXGTK__ )
dataDir = wxStandardPaths::Get().GetUserDataDir() + wxT("-data");
#else
dataDir = wxStandardPaths::Get().GetUserDataDir();
dataDir = dataDir + wxT("-data");
#endif
gDataDir = FileNames::MkDir(dataDir);
}
}
return gDataDir;
}
wxString FileNames::ResourcesDir(){
wxString resourcesDir( LowerCaseAppNameInPath( wxStandardPaths::Get().GetResourcesDir() ));
return resourcesDir;
}
wxString FileNames::HtmlHelpDir()
{
#if defined(__WXMAC__)
@@ -136,14 +152,13 @@ wxString FileNames::HtmlHelpDir()
// just remove the MacOSX part.
exePath.RemoveLastDir();
//for mac this puts us within the .app: Audacity.app/Contents/SharedSupport/
return wxFileName( exePath.GetPath()+wxT("/help/manual"), wxEmptyString ).GetFullPath();
#else
//linux goes into /*prefix*/share/audacity/
//windows goes into the dir containing the .exe
wxString exeDir = wxStandardPaths::Get().GetDataDir();
//for mac this puts us within the .app: Audacity.app/Contents/SharedSupport/
return wxFileName( exeDir+wxT("/help/manual"), wxEmptyString ).GetFullPath();
//windows (probably) goes into the dir containing the .exe
wxString dataDir = FileNames::LowerCaseAppNameInPath( wxStandardPaths::Get().GetDataDir());
return wxFileName( dataDir+wxT("/help/manual"), wxEmptyString ).GetFullPath();
#endif
}
@@ -195,7 +210,7 @@ wxString FileNames::BaseDir()
baseDir = PlatformCompatibility::GetExecutablePath();
#else
// Linux goes into /*prefix*/share/audacity/
baseDir = wxStandardPaths::Get().GetDataDir();
baseDir = FileNames::LowerCaseAppNameInPath(wxStandardPaths::Get().GetDataDir());
#endif
return baseDir.GetPath();