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:
parent
a05d039055
commit
53c3adfbe7
|
@ -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();
|
||||
|
|
|
@ -28,12 +28,14 @@ public:
|
|||
// originally an ExportMultiple method. Append suffix if newName appears in otherNames.
|
||||
static void MakeNameUnique(wxArrayString &otherNames, wxFileName &newName);
|
||||
|
||||
static wxString LowerCaseAppNameInPath( const wxString & dirIn);
|
||||
/** \brief Audacity user data directory
|
||||
*
|
||||
* Where audacity keeps it's settings and other user data squirreled away,
|
||||
* by default ~/.audacity-data/ on Unix, Application Data/Audacity on
|
||||
* windows system */
|
||||
static wxString DataDir();
|
||||
static wxString ResourcesDir();
|
||||
static wxString AutoSaveDir();
|
||||
static wxString HtmlHelpDir();
|
||||
static wxString HtmlHelpIndexFile(bool quick);
|
||||
|
|
|
@ -149,7 +149,9 @@ void InitPreferences()
|
|||
wxString langCode = gPrefs->Read(wxT("/Locale/Language"), wxEmptyString);
|
||||
bool writeLang = false;
|
||||
|
||||
const wxFileName fn(wxStandardPaths::Get().GetResourcesDir(), wxT("FirstTime.ini"));
|
||||
const wxFileName fn(
|
||||
FileNames::ResourcesDir(),
|
||||
wxT("FirstTime.ini"));
|
||||
if (fn.FileExists()) // it will exist if the (win) installer put it there
|
||||
{
|
||||
const wxString fullPath{fn.GetFullPath()};
|
||||
|
|
|
@ -1466,9 +1466,8 @@ void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */)
|
|||
EQCurveArray userCurves = mCurves;
|
||||
mCurves.Clear();
|
||||
// We only wamt to look for the shipped EQDefaultCurves.xml
|
||||
wxFileName fn = wxFileName(wxStandardPaths::Get().GetResourcesDir(),
|
||||
wxT("EQDefaultCurves.xml"));
|
||||
wxLogDebug(wxT("Attempting to load EQDefaultCurves.xml from %s"),wxStandardPaths::Get().GetResourcesDir().c_str());
|
||||
wxFileName fn = wxFileName(FileNames::ResourcesDir(), wxT("EQDefaultCurves.xml"));
|
||||
wxLogDebug(wxT("Attempting to load EQDefaultCurves.xml from %s"),fn.GetFullPath().c_str());
|
||||
XMLFileReader reader;
|
||||
|
||||
if(!reader.Parse(this, fn.GetFullPath())) {
|
||||
|
@ -1577,9 +1576,7 @@ bool EffectEqualization::GetDefaultFileName(wxFileName &fileName)
|
|||
if( !fileName.FileExists() )
|
||||
{ // Default file not found in the data dir. Fall back to Resources dir.
|
||||
// See http://docs.wxwidgets.org/trunk/classwx_standard_paths.html#5514bf6288ee9f5a0acaf065762ad95d
|
||||
static wxString resourcesDir;
|
||||
resourcesDir = wxStandardPaths::Get().GetResourcesDir();
|
||||
fileName = wxFileName( resourcesDir, wxT("EQDefaultCurves.xml") );
|
||||
fileName = wxFileName( FileNames::ResourcesDir(), wxT("EQDefaultCurves.xml") );
|
||||
}
|
||||
if( !fileName.FileExists() )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue