mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-20 17:41:13 +02:00
Move AudacityPathList & utilities from AudacityApp.h to FileNames.h
This commit is contained in:
@@ -98,6 +98,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class wxDialog;
|
class wxDialog;
|
||||||
|
class wxWindow;
|
||||||
class EffectUIHostInterface;
|
class EffectUIHostInterface;
|
||||||
class EffectUIClientInterface;
|
class EffectUIClientInterface;
|
||||||
|
|
||||||
|
@@ -36,7 +36,6 @@ It handles initialization and termination by subclassing wxApp.
|
|||||||
#include <wx/docview.h>
|
#include <wx/docview.h>
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
#include <wx/ipc.h>
|
#include <wx/ipc.h>
|
||||||
#include <wx/log.h>
|
|
||||||
#include <wx/window.h>
|
#include <wx/window.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/menu.h>
|
#include <wx/menu.h>
|
||||||
@@ -989,8 +988,8 @@ wxString AudacityApp::SetLang( const wxString & lang )
|
|||||||
}
|
}
|
||||||
mLocale = std::make_unique<wxLocale>(info->Language);
|
mLocale = std::make_unique<wxLocale>(info->Language);
|
||||||
|
|
||||||
for(unsigned int i=0; i<audacityPathList.size(); i++)
|
for( const auto &path : FileNames::AudacityPathList() )
|
||||||
mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]);
|
mLocale->AddCatalogLookupPathPrefix( path );
|
||||||
|
|
||||||
// LL: Must add the wxWidgets catalog manually since the search
|
// LL: Must add the wxWidgets catalog manually since the search
|
||||||
// paths were not set up when mLocale was created. The
|
// paths were not set up when mLocale was created. The
|
||||||
@@ -1266,6 +1265,7 @@ bool AudacityApp::OnInit()
|
|||||||
//
|
//
|
||||||
// Paths: set search path and temp dir path
|
// Paths: set search path and temp dir path
|
||||||
//
|
//
|
||||||
|
FilePaths audacityPathList;
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
/* Search path (for plug-ins, translations etc) is (in this order):
|
/* Search path (for plug-ins, translations etc) is (in this order):
|
||||||
@@ -1294,36 +1294,36 @@ bool AudacityApp::OnInit()
|
|||||||
wxString pathVar = wxGetenv(wxT("DARKAUDACITY_PATH"));
|
wxString pathVar = wxGetenv(wxT("DARKAUDACITY_PATH"));
|
||||||
#endif
|
#endif
|
||||||
if (!pathVar.empty())
|
if (!pathVar.empty())
|
||||||
AddMultiPathsToPathList(pathVar, audacityPathList);
|
FileNames::AddMultiPathsToPathList(pathVar, audacityPathList);
|
||||||
AddUniquePathToPathList(::wxGetCwd(), audacityPathList);
|
FileNames::AddUniquePathToPathList(::wxGetCwd(), audacityPathList);
|
||||||
|
|
||||||
#ifdef AUDACITY_NAME
|
#ifdef AUDACITY_NAME
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/.%s-files"),
|
FileNames::AddUniquePathToPathList(wxString::Format(wxT("%s/.%s-files"),
|
||||||
home, wxT(AUDACITY_NAME)),
|
home, wxT(AUDACITY_NAME)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/%s"),
|
FileNames::AddUniquePathToPathList(wxString::Format(wxT("%s/share/%s"),
|
||||||
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
|
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/%s"),
|
FileNames::AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/%s"),
|
||||||
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
|
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
#else //AUDACITY_NAME
|
#else //AUDACITY_NAME
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/.audacity-files"),
|
FileNames::AddUniquePathToPathList(wxString::Format(wxT("%s/.audacity-files"),
|
||||||
home),
|
home),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/audacity"),
|
FileNames::AddUniquePathToPathList(wxString::Format(wxT("%s/share/audacity"),
|
||||||
wxT(INSTALL_PREFIX)),
|
wxT(INSTALL_PREFIX)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/audacity"),
|
FileNames::AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/audacity"),
|
||||||
wxT(INSTALL_PREFIX)),
|
wxT(INSTALL_PREFIX)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
#endif //AUDACITY_NAME
|
#endif //AUDACITY_NAME
|
||||||
|
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/locale"),
|
FileNames::AddUniquePathToPathList(wxString::Format(wxT("%s/share/locale"),
|
||||||
wxT(INSTALL_PREFIX)),
|
wxT(INSTALL_PREFIX)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
|
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("./locale")),
|
FileNames::AddUniquePathToPathList(wxString::Format(wxT("./locale")),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
|
|
||||||
#endif //__WXGTK__
|
#endif //__WXGTK__
|
||||||
@@ -1346,8 +1346,8 @@ bool AudacityApp::OnInit()
|
|||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// On Windows, the path to the Audacity program is in argv[0]
|
// On Windows, the path to the Audacity program is in argv[0]
|
||||||
wxString progPath = wxPathOnly(argv[0]);
|
wxString progPath = wxPathOnly(argv[0]);
|
||||||
AddUniquePathToPathList(progPath, audacityPathList);
|
FileNames::AddUniquePathToPathList(progPath, audacityPathList);
|
||||||
AddUniquePathToPathList(progPath + wxT("\\Languages"), audacityPathList);
|
FileNames::AddUniquePathToPathList(progPath + wxT("\\Languages"), audacityPathList);
|
||||||
|
|
||||||
// See bug #1271 for explanation of location
|
// See bug #1271 for explanation of location
|
||||||
tmpDirLoc = FileNames::MkDir(wxStandardPaths::Get().GetUserLocalDataDir());
|
tmpDirLoc = FileNames::MkDir(wxStandardPaths::Get().GetUserLocalDataDir());
|
||||||
@@ -1359,14 +1359,16 @@ bool AudacityApp::OnInit()
|
|||||||
// On Mac OS X, the path to the Audacity program is in argv[0]
|
// On Mac OS X, the path to the Audacity program is in argv[0]
|
||||||
wxString progPath = wxPathOnly(argv[0]);
|
wxString progPath = wxPathOnly(argv[0]);
|
||||||
|
|
||||||
AddUniquePathToPathList(progPath, audacityPathList);
|
FileNames::AddUniquePathToPathList(progPath, audacityPathList);
|
||||||
// If Audacity is a "bundle" package, then the root directory is
|
// If Audacity is a "bundle" package, then the root directory is
|
||||||
// the great-great-grandparent of the directory containing the executable.
|
// the great-great-grandparent of the directory containing the executable.
|
||||||
//AddUniquePathToPathList(progPath + wxT("/../../../"), audacityPathList);
|
//FileNames::AddUniquePathToPathList(progPath + wxT("/../../../"), audacityPathList);
|
||||||
|
|
||||||
// These allow for searching the "bundle"
|
// These allow for searching the "bundle"
|
||||||
AddUniquePathToPathList(progPath + wxT("/../"), audacityPathList);
|
FileNames::AddUniquePathToPathList(
|
||||||
AddUniquePathToPathList(progPath + wxT("/../Resources"), audacityPathList);
|
progPath + wxT("/../"), audacityPathList);
|
||||||
|
FileNames::AddUniquePathToPathList(
|
||||||
|
progPath + wxT("/../Resources"), audacityPathList);
|
||||||
|
|
||||||
// JKC Bug 1220: Using an actual temp directory for session data on Mac was
|
// JKC Bug 1220: Using an actual temp directory for session data on Mac was
|
||||||
// wrong because it would get cleared out on a reboot.
|
// wrong because it would get cleared out on a reboot.
|
||||||
@@ -1379,6 +1381,8 @@ bool AudacityApp::OnInit()
|
|||||||
// wxGetUserId() ) );
|
// wxGetUserId() ) );
|
||||||
#endif //__WXMAC__
|
#endif //__WXMAC__
|
||||||
|
|
||||||
|
FileNames::SetAudacityPathList( std::move( audacityPathList ) );
|
||||||
|
|
||||||
// Define languanges for which we have translations, but that are not yet
|
// Define languanges for which we have translations, but that are not yet
|
||||||
// supported by wxWidgets.
|
// supported by wxWidgets.
|
||||||
//
|
//
|
||||||
@@ -2021,54 +2025,6 @@ std::unique_ptr<wxCmdLineParser> AudacityApp::ParseCommandLine()
|
|||||||
return{};
|
return{};
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
void AudacityApp::AddUniquePathToPathList(const FilePath &pathArg,
|
|
||||||
FilePaths &pathList)
|
|
||||||
{
|
|
||||||
wxFileName pathNorm = pathArg;
|
|
||||||
pathNorm.Normalize();
|
|
||||||
const wxString newpath{ pathNorm.GetFullPath() };
|
|
||||||
|
|
||||||
for(unsigned int i=0; i<pathList.size(); i++) {
|
|
||||||
if (wxFileName(newpath) == wxFileName(pathList[i]))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pathList.push_back(newpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
void AudacityApp::AddMultiPathsToPathList(const wxString &multiPathStringArg,
|
|
||||||
FilePaths &pathList)
|
|
||||||
{
|
|
||||||
wxString multiPathString(multiPathStringArg);
|
|
||||||
while (!multiPathString.empty()) {
|
|
||||||
wxString onePath = multiPathString.BeforeFirst(wxPATH_SEP[0]);
|
|
||||||
multiPathString = multiPathString.AfterFirst(wxPATH_SEP[0]);
|
|
||||||
AddUniquePathToPathList(onePath, pathList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
void AudacityApp::FindFilesInPathList(const wxString & pattern,
|
|
||||||
const FilePaths & pathList,
|
|
||||||
FilePaths & results,
|
|
||||||
int flags)
|
|
||||||
{
|
|
||||||
wxLogNull nolog;
|
|
||||||
|
|
||||||
if (pattern.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxFileName ff;
|
|
||||||
|
|
||||||
for(size_t i = 0; i < pathList.size(); i++) {
|
|
||||||
ff = pathList[i] + wxFILE_SEP_PATH + pattern;
|
|
||||||
wxDir::GetAllFiles(ff.GetPath(), &results, ff.GetFullName(), flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudacityApp::OnQueryEndSession(wxCloseEvent & event)
|
void AudacityApp::OnQueryEndSession(wxCloseEvent & event)
|
||||||
{
|
{
|
||||||
bool mustVeto = false;
|
bool mustVeto = false;
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
#include "Experimental.h"
|
#include "Experimental.h"
|
||||||
|
|
||||||
#include <wx/app.h> // to inherit
|
#include <wx/app.h> // to inherit
|
||||||
#include <wx/dir.h> // for wxDIR_FILES
|
|
||||||
#include <wx/timer.h> // member variable
|
#include <wx/timer.h> // member variable
|
||||||
|
|
||||||
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
||||||
@@ -113,26 +112,6 @@ class AudacityApp final : public wxApp {
|
|||||||
void AssociateFileTypes();
|
void AssociateFileTypes();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** \brief A list of directories that should be searched for Audacity files
|
|
||||||
* (plug-ins, help files, etc.).
|
|
||||||
*
|
|
||||||
* On Unix this will include the directory Audacity was installed into,
|
|
||||||
* plus the current user's .audacity-data/Plug-Ins directory. Additional
|
|
||||||
* directories can be specified using the AUDACITY_PATH environment
|
|
||||||
* variable. On Windows or Mac OS, this will include the directory
|
|
||||||
* which contains the Audacity program. */
|
|
||||||
FilePaths audacityPathList;
|
|
||||||
|
|
||||||
// Useful functions for working with search paths
|
|
||||||
static void AddUniquePathToPathList(const FilePath &path,
|
|
||||||
FilePaths &pathList);
|
|
||||||
static void AddMultiPathsToPathList(const wxString &multiPathString,
|
|
||||||
FilePaths &pathList);
|
|
||||||
static void FindFilesInPathList(const wxString & pattern,
|
|
||||||
const FilePaths & pathList,
|
|
||||||
FilePaths &results,
|
|
||||||
int flags = wxDIR_FILES);
|
|
||||||
|
|
||||||
bool GetWindowRectAlreadySaved()const {return mWindowRectAlreadySaved;}
|
bool GetWindowRectAlreadySaved()const {return mWindowRectAlreadySaved;}
|
||||||
void SetWindowRectAlreadySaved(bool alreadySaved) {mWindowRectAlreadySaved = alreadySaved;}
|
void SetWindowRectAlreadySaved(bool alreadySaved) {mWindowRectAlreadySaved = alreadySaved;}
|
||||||
|
|
||||||
|
@@ -519,3 +519,65 @@ bool FileNames::IsTempDirectoryNameOK( const FilePath & Name )
|
|||||||
#endif
|
#endif
|
||||||
return !(NameCanonical.StartsWith( BadPath ));
|
return !(NameCanonical.StartsWith( BadPath ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FilePaths sAudacityPathList;
|
||||||
|
|
||||||
|
const FilePaths &FileNames::AudacityPathList()
|
||||||
|
{
|
||||||
|
return sAudacityPathList;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileNames::SetAudacityPathList( FilePaths list )
|
||||||
|
{
|
||||||
|
sAudacityPathList = std::move( list );
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void FileNames::AddUniquePathToPathList(const FilePath &pathArg,
|
||||||
|
FilePaths &pathList)
|
||||||
|
{
|
||||||
|
wxFileNameWrapper pathNorm { pathArg };
|
||||||
|
pathNorm.Normalize();
|
||||||
|
const wxString newpath{ pathNorm.GetFullPath() };
|
||||||
|
|
||||||
|
for(const auto &path : pathList) {
|
||||||
|
if (pathNorm == wxFileNameWrapper{ path })
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pathList.push_back(newpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void FileNames::AddMultiPathsToPathList(const wxString &multiPathStringArg,
|
||||||
|
FilePaths &pathList)
|
||||||
|
{
|
||||||
|
wxString multiPathString(multiPathStringArg);
|
||||||
|
while (!multiPathString.empty()) {
|
||||||
|
wxString onePath = multiPathString.BeforeFirst(wxPATH_SEP[0]);
|
||||||
|
multiPathString = multiPathString.AfterFirst(wxPATH_SEP[0]);
|
||||||
|
AddUniquePathToPathList(onePath, pathList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
|
// static
|
||||||
|
void FileNames::FindFilesInPathList(const wxString & pattern,
|
||||||
|
const FilePaths & pathList,
|
||||||
|
FilePaths & results,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
wxLogNull nolog;
|
||||||
|
|
||||||
|
if (pattern.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFileNameWrapper ff;
|
||||||
|
|
||||||
|
for(size_t i = 0; i < pathList.size(); i++) {
|
||||||
|
ff = pathList[i] + wxFILE_SEP_PATH + pattern;
|
||||||
|
wxDir::GetAllFiles(ff.GetPath(), &results, ff.GetFullName(), flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "Audacity.h"
|
#include "Audacity.h"
|
||||||
|
|
||||||
|
#include <wx/dir.h> // for wxDIR_FILES
|
||||||
#include <wx/string.h> // function return value
|
#include <wx/string.h> // function return value
|
||||||
#include "audacity/Types.h"
|
#include "audacity/Types.h"
|
||||||
|
|
||||||
@@ -40,6 +41,17 @@ public:
|
|||||||
static void SetDefaultTempDir( const FilePath &tempDir );
|
static void SetDefaultTempDir( const FilePath &tempDir );
|
||||||
static bool IsTempDirectoryNameOK( const FilePath & Name );
|
static bool IsTempDirectoryNameOK( const FilePath & Name );
|
||||||
|
|
||||||
|
/** \brief A list of directories that should be searched for Audacity files
|
||||||
|
* (plug-ins, help files, etc.).
|
||||||
|
*
|
||||||
|
* On Unix this will include the directory Audacity was installed into,
|
||||||
|
* plus the current user's .audacity-data/Plug-Ins directory. Additional
|
||||||
|
* directories can be specified using the AUDACITY_PATH environment
|
||||||
|
* variable. On Windows or Mac OS, this will include the directory
|
||||||
|
* which contains the Audacity program. */
|
||||||
|
static const FilePaths &AudacityPathList();
|
||||||
|
static void SetAudacityPathList( FilePaths list );
|
||||||
|
|
||||||
// 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(
|
static void MakeNameUnique(
|
||||||
FilePaths &otherNames, wxFileName &newName);
|
FilePaths &otherNames, wxFileName &newName);
|
||||||
@@ -123,6 +135,16 @@ public:
|
|||||||
int flags,
|
int flags,
|
||||||
wxWindow *parent);
|
wxWindow *parent);
|
||||||
|
|
||||||
|
// Useful functions for working with search paths
|
||||||
|
static void AddUniquePathToPathList(const FilePath &path,
|
||||||
|
FilePaths &pathList);
|
||||||
|
static void AddMultiPathsToPathList(const wxString &multiPathString,
|
||||||
|
FilePaths &pathList);
|
||||||
|
static void FindFilesInPathList(const wxString & pattern,
|
||||||
|
const FilePaths & pathList,
|
||||||
|
FilePaths &results,
|
||||||
|
int flags = wxDIR_FILES);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private constructors: No one is ever going to instantiate it.
|
// Private constructors: No one is ever going to instantiate it.
|
||||||
//
|
//
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "Audacity.h"
|
#include "Audacity.h"
|
||||||
#include "Languages.h"
|
#include "Languages.h"
|
||||||
|
#include "MemoryX.h"
|
||||||
|
|
||||||
#include "audacity/Types.h"
|
#include "audacity/Types.h"
|
||||||
|
|
||||||
@@ -41,8 +42,6 @@
|
|||||||
|
|
||||||
#include "FileNames.h"
|
#include "FileNames.h"
|
||||||
|
|
||||||
#include "AudacityApp.h"
|
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
using LangHash = std::unordered_map<wxString, wxString>;
|
using LangHash = std::unordered_map<wxString, wxString>;
|
||||||
@@ -50,18 +49,18 @@ using LangHash = std::unordered_map<wxString, wxString>;
|
|||||||
static bool TranslationExists(const FilePaths &audacityPathList, wxString code)
|
static bool TranslationExists(const FilePaths &audacityPathList, wxString code)
|
||||||
{
|
{
|
||||||
FilePaths results;
|
FilePaths results;
|
||||||
wxGetApp().FindFilesInPathList(wxString::Format(wxT("%s/audacity.mo"),
|
FileNames::FindFilesInPathList(wxString::Format(wxT("%s/audacity.mo"),
|
||||||
code),
|
code),
|
||||||
audacityPathList,
|
audacityPathList,
|
||||||
results);
|
results);
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
wxGetApp().FindFilesInPathList(wxString::Format(wxT("%s.lproj/audacity.mo"),
|
FileNames::FindFilesInPathList(wxString::Format(wxT("%s.lproj/audacity.mo"),
|
||||||
code),
|
code),
|
||||||
audacityPathList,
|
audacityPathList,
|
||||||
results);
|
results);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxGetApp().FindFilesInPathList(wxString::Format(wxT("%s/LC_MESSAGES/audacity.mo"),
|
FileNames::FindFilesInPathList(wxString::Format(wxT("%s/LC_MESSAGES/audacity.mo"),
|
||||||
code),
|
code),
|
||||||
audacityPathList,
|
audacityPathList,
|
||||||
results);
|
results);
|
||||||
@@ -203,12 +202,13 @@ void GetLanguages(wxArrayString &langCodes, wxArrayString &langNames)
|
|||||||
localLanguageName[code] = name;
|
localLanguageName[code] = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto audacityPathList = wxGetApp().audacityPathList;
|
auto audacityPathList = FileNames::AudacityPathList();
|
||||||
|
|
||||||
#if defined(__WXGTK__)
|
#if defined(__WXGTK__)
|
||||||
wxGetApp().AddUniquePathToPathList(wxString::Format(wxT("%s/share/locale"),
|
FileNames::AddUniquePathToPathList(
|
||||||
wxT(INSTALL_PREFIX)),
|
wxString::Format(wxT("%s/share/locale"),
|
||||||
audacityPathList);
|
wxT(INSTALL_PREFIX)),
|
||||||
|
audacityPathList);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For each language in our list we look for a corresponding entry in
|
// For each language in our list we look for a corresponding entry in
|
||||||
|
@@ -28,7 +28,6 @@ i.e. an alternative to the usual interface, for Audacity.
|
|||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
|
||||||
#include "AudacityApp.h"
|
|
||||||
#include "FileNames.h"
|
#include "FileNames.h"
|
||||||
#include "PluginManager.h"
|
#include "PluginManager.h"
|
||||||
|
|
||||||
@@ -212,7 +211,7 @@ ModuleManager::~ModuleManager()
|
|||||||
// static
|
// static
|
||||||
void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
||||||
{
|
{
|
||||||
const auto &audacityPathList = wxGetApp().audacityPathList;
|
const auto &audacityPathList = FileNames::AudacityPathList();
|
||||||
FilePaths pathList;
|
FilePaths pathList;
|
||||||
FilePaths files;
|
FilePaths files;
|
||||||
wxString pathVar;
|
wxString pathVar;
|
||||||
@@ -221,18 +220,18 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
|||||||
// Code from LoadLadspa that might be useful in load modules.
|
// Code from LoadLadspa that might be useful in load modules.
|
||||||
pathVar = wxGetenv(wxT("AUDACITY_MODULES_PATH"));
|
pathVar = wxGetenv(wxT("AUDACITY_MODULES_PATH"));
|
||||||
if (!pathVar.empty())
|
if (!pathVar.empty())
|
||||||
wxGetApp().AddMultiPathsToPathList(pathVar, pathList);
|
FileNames::AddMultiPathsToPathList(pathVar, pathList);
|
||||||
|
|
||||||
for (i = 0; i < audacityPathList.size(); i++) {
|
for (i = 0; i < audacityPathList.size(); i++) {
|
||||||
wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH;
|
wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH;
|
||||||
wxGetApp().AddUniquePathToPathList(prefix + wxT("modules"),
|
FileNames::AddUniquePathToPathList(prefix + wxT("modules"),
|
||||||
pathList);
|
pathList);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, files);
|
FileNames::FindFilesInPathList(wxT("*.dll"), pathList, files);
|
||||||
#else
|
#else
|
||||||
wxGetApp().FindFilesInPathList(wxT("*.so"), pathList, files);
|
FileNames::FindFilesInPathList(wxT("*.so"), pathList, files);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxString saveOldCWD = ::wxGetCwd();
|
wxString saveOldCWD = ::wxGetCwd();
|
||||||
@@ -357,19 +356,19 @@ bool ModuleManager::DiscoverProviders()
|
|||||||
|
|
||||||
if (!pathVar.empty())
|
if (!pathVar.empty())
|
||||||
{
|
{
|
||||||
wxGetApp().AddMultiPathsToPathList(pathVar, pathList);
|
FileNames::AddMultiPathsToPathList(pathVar, pathList);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxGetApp().AddUniquePathToPathList(FileNames::ModulesDir(), pathList);
|
FileNames::AddUniquePathToPathList(FileNames::ModulesDir(), pathList);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, provList);
|
FileNames::FindFilesInPathList(wxT("*.dll"), pathList, provList);
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
wxGetApp().FindFilesInPathList(wxT("*.dylib"), pathList, provList);
|
FileNames::FindFilesInPathList(wxT("*.dylib"), pathList, provList);
|
||||||
#else
|
#else
|
||||||
wxGetApp().FindFilesInPathList(wxT("*.so"), pathList, provList);
|
FileNames::FindFilesInPathList(wxT("*.so"), pathList, provList);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PluginManager & pm = PluginManager::Get();
|
PluginManager & pm = PluginManager::Get();
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#include "../../AudacityApp.h"
|
|
||||||
#include "LoadNyquist.h"
|
#include "LoadNyquist.h"
|
||||||
|
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
@@ -129,7 +128,7 @@ wxString NyquistEffectsModule::GetDescription()
|
|||||||
|
|
||||||
bool NyquistEffectsModule::Initialize()
|
bool NyquistEffectsModule::Initialize()
|
||||||
{
|
{
|
||||||
const auto &audacityPathList = wxGetApp().audacityPathList;
|
const auto &audacityPathList = FileNames::AudacityPathList();
|
||||||
|
|
||||||
for (size_t i = 0, cnt = audacityPathList.size(); i < cnt; i++)
|
for (size_t i = 0, cnt = audacityPathList.size(); i < cnt; i++)
|
||||||
{
|
{
|
||||||
|
@@ -2350,15 +2350,15 @@ void NyquistEffect::OSCallback()
|
|||||||
|
|
||||||
FilePaths NyquistEffect::GetNyquistSearchPath()
|
FilePaths NyquistEffect::GetNyquistSearchPath()
|
||||||
{
|
{
|
||||||
const auto &audacityPathList = wxGetApp().audacityPathList;
|
const auto &audacityPathList = FileNames::AudacityPathList();
|
||||||
FilePaths pathList;
|
FilePaths pathList;
|
||||||
|
|
||||||
for (size_t i = 0; i < audacityPathList.size(); i++)
|
for (size_t i = 0; i < audacityPathList.size(); i++)
|
||||||
{
|
{
|
||||||
wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH;
|
wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH;
|
||||||
wxGetApp().AddUniquePathToPathList(prefix + wxT("nyquist"), pathList);
|
FileNames::AddUniquePathToPathList(prefix + wxT("nyquist"), pathList);
|
||||||
wxGetApp().AddUniquePathToPathList(prefix + wxT("plugins"), pathList);
|
FileNames::AddUniquePathToPathList(prefix + wxT("plugins"), pathList);
|
||||||
wxGetApp().AddUniquePathToPathList(prefix + wxT("plug-ins"), pathList);
|
FileNames::AddUniquePathToPathList(prefix + wxT("plug-ins"), pathList);
|
||||||
}
|
}
|
||||||
pathList.push_back(FileNames::PlugInDir());
|
pathList.push_back(FileNames::PlugInDir());
|
||||||
|
|
||||||
|
@@ -20,7 +20,9 @@ class wxArrayString;
|
|||||||
class wxFileNameWrapper : public wxFileName
|
class wxFileNameWrapper : public wxFileName
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit
|
using wxFileName::wxFileName;
|
||||||
|
|
||||||
|
explicit
|
||||||
wxFileNameWrapper(const wxFileName &that)
|
wxFileNameWrapper(const wxFileName &that)
|
||||||
: wxFileName(that)
|
: wxFileName(that)
|
||||||
{}
|
{}
|
||||||
|
Reference in New Issue
Block a user