From 44c4219d7c55b2e211d05f3b70ed61ce19d1772e Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 18 Feb 2021 17:37:48 -0500 Subject: [PATCH] FileNames does not depend on wx/app.h... ... The string constant used at startup in SetAppName() (which is called nowhere else) is made known to FileNames, so it need not use GetAppName(). --- src/AudacityApp.cpp | 11 +---------- src/FileNames.cpp | 13 +++++++++++-- src/FileNames.h | 3 +++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 7bdb0d2ad..098a2d362 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1118,16 +1118,7 @@ bool AudacityApp::OnInit() "widget_class \"*GtkCombo*\" style \"audacity\""); #endif - // Don't use AUDACITY_NAME here. - // We want Audacity with a capital 'A' - -// DA: App name -#ifndef EXPERIMENTAL_DA - wxString appName = wxT("Audacity"); -#else - wxString appName = wxT("DarkAudacity"); -#endif - + const auto &appName = FileNames::AppName; wxTheApp->SetAppName(appName); // Explicitly set since OSX will use it for the "Quit" menu item wxTheApp->SetAppDisplayName(appName); diff --git a/src/FileNames.cpp b/src/FileNames.cpp index 7c8e70e54..591e7b24f 100644 --- a/src/FileNames.cpp +++ b/src/FileNames.cpp @@ -27,7 +27,6 @@ used throughout Audacity into this one place. #include -#include #include #include #include @@ -468,7 +467,8 @@ wxFileNameWrapper FileNames::DefaultToDocumentsFolder(const wxString &preference #ifdef __WIN32__ wxFileName defaultPath( wxStandardPaths::Get().GetDocumentsDir(), "" ); - defaultPath.AppendDir( wxTheApp->GetAppName() ); + + defaultPath.AppendDir( AppName ); result.SetPath( gPrefs->Read( preference, defaultPath.GetPath( wxPATH_GET_VOLUME ) ) ); // MJB: Bug 1899 & Bug 2007. Only create directory if the result is the default path @@ -766,3 +766,12 @@ wxString FileNames::AbbreviatePath( const wxFileName &fileName ) return target; } +// We want Audacity with a capital 'A' +// DA: App name +const wxString FileNames::AppName = +#ifndef EXPERIMENTAL_DA + L"Audacity" +#else + L"DarkAudacity" +#endif +; diff --git a/src/FileNames.h b/src/FileNames.h index 78f28a97e..66fe10b00 100644 --- a/src/FileNames.h +++ b/src/FileNames.h @@ -225,6 +225,9 @@ namespace FileNames AUDACITY_DLL_API //! Give enough of the path to identify the device. (On Windows, drive letter plus ':') wxString AbbreviatePath(const wxFileName &fileName); + + AUDACITY_DLL_API + extern const wxString AppName; }; #endif