mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-17 16:50:26 +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:
parent
a05d039055
commit
53c3adfbe7
@ -84,6 +84,21 @@ wxString FileNames::AutoSaveDir()
|
|||||||
return FileNames::MkDir(autoSaveDir.GetFullPath());
|
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()
|
wxString FileNames::DataDir()
|
||||||
{
|
{
|
||||||
// LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict
|
// LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict
|
||||||
@ -112,20 +127,21 @@ wxString FileNames::DataDir()
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// Use OS-provided user data dir folder
|
// Use OS-provided user data dir folder
|
||||||
wxString dataDir;
|
wxString dataDir( LowerCaseAppNameInPath( wxStandardPaths::Get().GetUserDataDir() ));
|
||||||
#if defined( __WXGTK__ )
|
#if defined( __WXGTK__ )
|
||||||
dataDir = wxStandardPaths::Get().GetUserDataDir() + wxT("-data");
|
dataDir = dataDir + wxT("-data");
|
||||||
#else
|
|
||||||
dataDir = wxStandardPaths::Get().GetUserDataDir();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gDataDir = FileNames::MkDir(dataDir);
|
gDataDir = FileNames::MkDir(dataDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return gDataDir;
|
return gDataDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString FileNames::ResourcesDir(){
|
||||||
|
wxString resourcesDir( LowerCaseAppNameInPath( wxStandardPaths::Get().GetResourcesDir() ));
|
||||||
|
return resourcesDir;
|
||||||
|
}
|
||||||
|
|
||||||
wxString FileNames::HtmlHelpDir()
|
wxString FileNames::HtmlHelpDir()
|
||||||
{
|
{
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
@ -136,14 +152,13 @@ wxString FileNames::HtmlHelpDir()
|
|||||||
// just remove the MacOSX part.
|
// just remove the MacOSX part.
|
||||||
exePath.RemoveLastDir();
|
exePath.RemoveLastDir();
|
||||||
|
|
||||||
|
//for mac this puts us within the .app: Audacity.app/Contents/SharedSupport/
|
||||||
return wxFileName( exePath.GetPath()+wxT("/help/manual"), wxEmptyString ).GetFullPath();
|
return wxFileName( exePath.GetPath()+wxT("/help/manual"), wxEmptyString ).GetFullPath();
|
||||||
#else
|
#else
|
||||||
//linux goes into /*prefix*/share/audacity/
|
//linux goes into /*prefix*/share/audacity/
|
||||||
//windows goes into the dir containing the .exe
|
//windows (probably) goes into the dir containing the .exe
|
||||||
wxString exeDir = wxStandardPaths::Get().GetDataDir();
|
wxString dataDir = FileNames::LowerCaseAppNameInPath( wxStandardPaths::Get().GetDataDir());
|
||||||
|
return wxFileName( dataDir+wxT("/help/manual"), wxEmptyString ).GetFullPath();
|
||||||
//for mac this puts us within the .app: Audacity.app/Contents/SharedSupport/
|
|
||||||
return wxFileName( exeDir+wxT("/help/manual"), wxEmptyString ).GetFullPath();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +210,7 @@ wxString FileNames::BaseDir()
|
|||||||
baseDir = PlatformCompatibility::GetExecutablePath();
|
baseDir = PlatformCompatibility::GetExecutablePath();
|
||||||
#else
|
#else
|
||||||
// Linux goes into /*prefix*/share/audacity/
|
// Linux goes into /*prefix*/share/audacity/
|
||||||
baseDir = wxStandardPaths::Get().GetDataDir();
|
baseDir = FileNames::LowerCaseAppNameInPath(wxStandardPaths::Get().GetDataDir());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return baseDir.GetPath();
|
return baseDir.GetPath();
|
||||||
|
@ -28,12 +28,14 @@ public:
|
|||||||
// originally an ExportMultiple method. Append suffix if newName appears in otherNames.
|
// originally an ExportMultiple method. Append suffix if newName appears in otherNames.
|
||||||
static void MakeNameUnique(wxArrayString &otherNames, wxFileName &newName);
|
static void MakeNameUnique(wxArrayString &otherNames, wxFileName &newName);
|
||||||
|
|
||||||
|
static wxString LowerCaseAppNameInPath( const wxString & dirIn);
|
||||||
/** \brief Audacity user data directory
|
/** \brief Audacity user data directory
|
||||||
*
|
*
|
||||||
* Where audacity keeps it's settings and other user data squirreled away,
|
* Where audacity keeps it's settings and other user data squirreled away,
|
||||||
* by default ~/.audacity-data/ on Unix, Application Data/Audacity on
|
* by default ~/.audacity-data/ on Unix, Application Data/Audacity on
|
||||||
* windows system */
|
* windows system */
|
||||||
static wxString DataDir();
|
static wxString DataDir();
|
||||||
|
static wxString ResourcesDir();
|
||||||
static wxString AutoSaveDir();
|
static wxString AutoSaveDir();
|
||||||
static wxString HtmlHelpDir();
|
static wxString HtmlHelpDir();
|
||||||
static wxString HtmlHelpIndexFile(bool quick);
|
static wxString HtmlHelpIndexFile(bool quick);
|
||||||
|
@ -149,7 +149,9 @@ void InitPreferences()
|
|||||||
wxString langCode = gPrefs->Read(wxT("/Locale/Language"), wxEmptyString);
|
wxString langCode = gPrefs->Read(wxT("/Locale/Language"), wxEmptyString);
|
||||||
bool writeLang = false;
|
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
|
if (fn.FileExists()) // it will exist if the (win) installer put it there
|
||||||
{
|
{
|
||||||
const wxString fullPath{fn.GetFullPath()};
|
const wxString fullPath{fn.GetFullPath()};
|
||||||
|
@ -1466,9 +1466,8 @@ void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */)
|
|||||||
EQCurveArray userCurves = mCurves;
|
EQCurveArray userCurves = mCurves;
|
||||||
mCurves.Clear();
|
mCurves.Clear();
|
||||||
// We only wamt to look for the shipped EQDefaultCurves.xml
|
// We only wamt to look for the shipped EQDefaultCurves.xml
|
||||||
wxFileName fn = wxFileName(wxStandardPaths::Get().GetResourcesDir(),
|
wxFileName fn = wxFileName(FileNames::ResourcesDir(), wxT("EQDefaultCurves.xml"));
|
||||||
wxT("EQDefaultCurves.xml"));
|
wxLogDebug(wxT("Attempting to load EQDefaultCurves.xml from %s"),fn.GetFullPath().c_str());
|
||||||
wxLogDebug(wxT("Attempting to load EQDefaultCurves.xml from %s"),wxStandardPaths::Get().GetResourcesDir().c_str());
|
|
||||||
XMLFileReader reader;
|
XMLFileReader reader;
|
||||||
|
|
||||||
if(!reader.Parse(this, fn.GetFullPath())) {
|
if(!reader.Parse(this, fn.GetFullPath())) {
|
||||||
@ -1577,9 +1576,7 @@ bool EffectEqualization::GetDefaultFileName(wxFileName &fileName)
|
|||||||
if( !fileName.FileExists() )
|
if( !fileName.FileExists() )
|
||||||
{ // Default file not found in the data dir. Fall back to Resources dir.
|
{ // Default file not found in the data dir. Fall back to Resources dir.
|
||||||
// See http://docs.wxwidgets.org/trunk/classwx_standard_paths.html#5514bf6288ee9f5a0acaf065762ad95d
|
// See http://docs.wxwidgets.org/trunk/classwx_standard_paths.html#5514bf6288ee9f5a0acaf065762ad95d
|
||||||
static wxString resourcesDir;
|
fileName = wxFileName( FileNames::ResourcesDir(), wxT("EQDefaultCurves.xml") );
|
||||||
resourcesDir = wxStandardPaths::Get().GetResourcesDir();
|
|
||||||
fileName = wxFileName( resourcesDir, wxT("EQDefaultCurves.xml") );
|
|
||||||
}
|
}
|
||||||
if( !fileName.FileExists() )
|
if( !fileName.FileExists() )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user