Audacity  2.2.2
Public Types | Static Public Member Functions | Private Member Functions | List of all members
FileNames Class Reference

Provides Static functions to yield filenames. More...

#include <FileNames.h>

Public Types

enum  Operation { Operation::_None, Operation::Open, Operation::Export }
 

Static Public Member Functions

static bool CopyFile (const wxString &file1, const wxString &file2, bool overwrite=true)
 
static wxString MkDir (const wxString &Str)
 
static wxString TempDir ()
 
static void MakeNameUnique (wxArrayString &otherNames, wxFileName &newName)
 
static wxString LowerCaseAppNameInPath (const wxString &dirIn)
 
static wxString DataDir ()
 Audacity user data directory. More...
 
static wxString ResourcesDir ()
 
static wxString AutoSaveDir ()
 
static wxString HtmlHelpDir ()
 
static wxString HtmlHelpIndexFile (bool quick)
 
static wxString LegacyChainDir ()
 
static wxString MacroDir ()
 
static wxString NRPDir ()
 
static wxString NRPFile ()
 
static wxString PluginRegistry ()
 
static wxString PluginSettings ()
 
static wxString BaseDir ()
 
static wxString ModulesDir ()
 
static wxString PlugInDir ()
 The user plug-in directory (not a system one) More...
 
static wxString ThemeDir ()
 
static wxString ThemeComponentsDir ()
 
static wxString ThemeCachePng ()
 
static wxString ThemeCacheAsCee ()
 
static wxString ThemeComponent (const wxString &Str)
 
static wxString ThemeCacheHtm ()
 
static wxString ThemeImageDefsAsCee ()
 
static wxString PathFromAddr (void *addr)
 
static wxFileNameWrapper DefaultToDocumentsFolder (const wxString &preference)
 
static wxString FindDefaultPath (Operation op)
 
static void UpdateDefaultPath (Operation op, const wxString &path)
 
template<typename F >
static wxString WithDefaultPath (Operation op, const wxString &defaultPath, F function)
 
static wxString SelectFile (Operation op, const wxString &message, const wxString &default_path, const wxString &default_filename, const wxString &default_extension, const wxString &wildcard, int flags, wxWindow *parent)
 

Private Member Functions

 FileNames ()
 
 ~FileNames ()
 

Detailed Description

Provides Static functions to yield filenames.

This class helps us with setting a base path, and makes it easier for us to keep track of the different kinds of files we read and write from.

JKC: In time I plan to add all file names and file extensions used throughout Audacity into this one place.

Definition at line 23 of file FileNames.h.

Member Enumeration Documentation

enum FileNames::Operation
strong
Enumerator
_None 
Open 
Export 

Definition at line 79 of file FileNames.h.

79  {
80  // _ on None to defeat some macro that is expanding this.
81  _None,
82  Open,
83  Export
84  };
Main class to control the export function.

Constructor & Destructor Documentation

FileNames::FileNames ( )
inlineprivate

Definition at line 115 of file FileNames.h.

115 {;};
FileNames::~FileNames ( )
inlineprivate

Definition at line 116 of file FileNames.h.

116 {;};

Member Function Documentation

wxString FileNames::AutoSaveDir ( )
static

Definition at line 109 of file FileNames.cpp.

References DataDir(), and MkDir().

Referenced by AudacityProject::AutoSave(), TimerRecordDialog::HaveFilesToRecover(), HaveFilesToRecover(), AutoRecoveryDialog::PopulateList(), RecoverAllProjects(), TimerRecordDialog::RemoveAllAutoSaveFiles(), and RemoveAllAutoSaveFiles().

110 {
111  wxFileName autoSaveDir(FileNames::DataDir(), wxT("AutoSave"));
112  return FileNames::MkDir(autoSaveDir.GetFullPath());
113 }
static wxString DataDir()
Audacity user data directory.
Definition: FileNames.cpp:130
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
wxString FileNames::BaseDir ( )
static

Definition at line 229 of file FileNames.cpp.

References PlatformCompatibility::GetExecutablePath(), and LowerCaseAppNameInPath().

Referenced by ModulesDir(), and NyquistEffect::Process().

230 {
231  wxFileName baseDir;
232 
233 #if defined(__WXMAC__)
235 
236  // Path ends for example in "Audacity.app/Contents/MacOSX"
237  //baseDir.RemoveLastDir();
238  //baseDir.RemoveLastDir();
239  // just remove the MacOSX part.
240  baseDir.RemoveLastDir();
241 #elif defined(__WXMSW__)
242  // Don't use wxStandardPaths::Get().GetDataDir() since it removes
243  // the "Debug" directory in debug builds.
245 #else
246  // Linux goes into /*prefix*/share/audacity/
247  baseDir = FileNames::LowerCaseAppNameInPath(wxStandardPaths::Get().GetDataDir());
248 #endif
249 
250  return baseDir.GetPath();
251 }
static const wxString & GetExecutablePath()
static wxString LowerCaseAppNameInPath(const wxString &dirIn)
Definition: FileNames.cpp:119
bool FileNames::CopyFile ( const wxString &  file1,
const wxString &  file2,
bool  overwrite = true 
)
static

Definition at line 46 of file FileNames.cpp.

Referenced by DirManager::CopyToNewProjectDirectory(), PluginManager::DropFile(), and MacroCommands::MigrateLegacyChains().

48 {
49 #ifdef __WXMSW__
50 
51  // workaround not needed
52  return wxCopyFile(file1, file2, overwrite);
53 
54 #else
55  // PRL: Compensate for buggy wxCopyFile that returns false success,
56  // which was a cause of case 4 in comment 10 of
57  // http://bugzilla.audacityteam.org/show_bug.cgi?id=1759
58  // Destination file was created, but was empty
59  // Bug was introduced after wxWidgets 2.8.12 at commit
60  // 0597e7f977c87d107e24bf3e95ebfa3d60efc249 of wxWidgets repo
61 
62  bool existed = wxFileExists(file2);
63  bool result = wxCopyFile(file1, file2, overwrite) &&
64  wxFile{ file1 }.Length() == wxFile{ file2 }.Length();
65  if (!result && !existed)
66  wxRemoveFile(file2);
67  return result;
68 
69 #endif
70 }
wxString FileNames::DataDir ( )
static

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

Definition at line 130 of file FileNames.cpp.

References gDataDir, PlatformCompatibility::GetExecutablePath(), LowerCaseAppNameInPath(), and MkDir().

Referenced by AutoSaveDir(), EffectEqualization::GetDefaultFileName(), InitPreferences(), LegacyChainDir(), EffectEqualization::LoadCurves(), Tags::LoadGenres(), MacroDir(), NRPDir(), TagsEditor::OnEdit(), EditCurvesDialog::OnExport(), EditCurvesDialog::OnImport(), TagsEditor::OnLoad(), EditCurvesDialog::OnOK(), TagsEditor::OnReset(), TagsEditor::OnSave(), PlugInDir(), PluginRegistry(), PluginSettings(), AboutDialog::PopulateInformationPage(), NyquistEffect::Process(), NyquistEffect::resolveFilePath(), EffectEqualization::SaveCurves(), and ThemeDir().

131 {
132  // LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict
133  // between wxStandardPaths and wxConfig under Linux. The latter
134  // creates a normal file as "$HOME/.audacity", while the former
135  // expects the ".audacity" portion to be a directory.
136  if (gDataDir.IsEmpty())
137  {
138  // If there is a directory "Portable Settings" relative to the
139  // executable's EXE file, the prefs are stored in there, otherwise
140  // the prefs are stored in the user data dir provided by the OS.
141  wxFileName exePath(PlatformCompatibility::GetExecutablePath());
142 #if defined(__WXMAC__)
143  // Path ends for example in "Audacity.app/Contents/MacOSX"
144  //exePath.RemoveLastDir();
145  //exePath.RemoveLastDir();
146  // just remove the MacOSX part.
147  exePath.RemoveLastDir();
148 #endif
149  wxFileName portablePrefsPath(exePath.GetPath(), wxT("Portable Settings"));
150 
151  if (::wxDirExists(portablePrefsPath.GetFullPath()))
152  {
153  // Use "Portable Settings" folder
154  gDataDir = portablePrefsPath.GetFullPath();
155  } else
156  {
157  // Use OS-provided user data dir folder
158  wxString dataDir( LowerCaseAppNameInPath( wxStandardPaths::Get().GetUserDataDir() ));
159 #if defined( __WXGTK__ )
160  dataDir = dataDir + wxT("-data");
161 #endif
162  gDataDir = FileNames::MkDir(dataDir);
163  }
164  }
165  return gDataDir;
166 }
static const wxString & GetExecutablePath()
static wxString LowerCaseAppNameInPath(const wxString &dirIn)
Definition: FileNames.cpp:119
static wxString gDataDir
Definition: FileNames.cpp:44
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
wxFileNameWrapper FileNames::DefaultToDocumentsFolder ( const wxString &  preference)
static

Definition at line 354 of file FileNames.cpp.

References gPrefs.

Referenced by FindDefaultPath(), Exporter::GetFilename(), ExportMultiple::PopulateOrExchange(), NyquistEffect::resolveFilePath(), and AudacityProject::SaveAs().

355 {
356  wxFileNameWrapper result;
357  result.AssignHomeDir();
358 
359 #ifdef __WIN32__
360  result.SetPath(gPrefs->Read(
361  preference, result.GetPath(wxPATH_GET_VOLUME) + "\\Documents\\Audacity"));
362  // The path might not exist.
363  // There is no error if the path could not be created. That's OK.
364  // The dialog that Audacity offers will allow the user to select a valid directory.
365  result.Mkdir(0755, wxPATH_MKDIR_FULL);
366 #else
367  result.SetPath(gPrefs->Read( preference, result.GetPath() + "/Documents"));
368 #endif
369 
370  return result;
371 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
wxString FileNames::FindDefaultPath ( Operation  op)
static

Definition at line 390 of file FileNames.cpp.

References DefaultToDocumentsFolder().

Referenced by MacroCommands::BuildCleanFileName(), ApplyMacroDialog::OnApplyToFiles(), AudacityProject::ShowOpenDialog(), and WithDefaultPath().

391 {
392  auto key = PreferenceKey(op);
393  if (key.empty())
394  return wxString{};
395  else
396  return DefaultToDocumentsFolder(key).GetPath();
397 }
static wxFileNameWrapper DefaultToDocumentsFolder(const wxString &preference)
Definition: FileNames.cpp:354
wxString FileNames::HtmlHelpDir ( )
static

Definition at line 173 of file FileNames.cpp.

References PlatformCompatibility::GetExecutablePath(), and LowerCaseAppNameInPath().

Referenced by FileLink(), LinkingHtmlWindow::OnLinkClicked(), NyquistEffect::Process(), and HelpSystem::ShowHelp().

174 {
175 #if defined(__WXMAC__)
176  wxFileName exePath(PlatformCompatibility::GetExecutablePath());
177  // Path ends for example in "Audacity.app/Contents/MacOSX"
178  //exePath.RemoveLastDir();
179  //exePath.RemoveLastDir();
180  // just remove the MacOSX part.
181  exePath.RemoveLastDir();
182 
183  //for mac this puts us within the .app: Audacity.app/Contents/SharedSupport/
184  return wxFileName( exePath.GetPath()+wxT("/help/manual"), wxEmptyString ).GetFullPath();
185 #else
186  //linux goes into /*prefix*/share/audacity/
187  //windows (probably) goes into the dir containing the .exe
188  wxString dataDir = FileNames::LowerCaseAppNameInPath( wxStandardPaths::Get().GetDataDir());
189  return wxFileName( dataDir+wxT("/help/manual"), wxEmptyString ).GetFullPath();
190 #endif
191 }
static const wxString & GetExecutablePath()
static wxString LowerCaseAppNameInPath(const wxString &dirIn)
Definition: FileNames.cpp:119
static wxString FileNames::HtmlHelpIndexFile ( bool  quick)
static
wxString FileNames::LegacyChainDir ( )
static

Definition at line 193 of file FileNames.cpp.

References DataDir().

Referenced by MacroCommands::DeleteMacro(), and MacroCommands::MigrateLegacyChains().

194 {
195  // Don't force creation of it
196  return wxFileName{ DataDir(), wxT("Chains") }.GetFullPath();
197 }
static wxString DataDir()
Audacity user data directory.
Definition: FileNames.cpp:130
wxString FileNames::LowerCaseAppNameInPath ( const wxString &  dirIn)
static

Definition at line 119 of file FileNames.cpp.

Referenced by BaseDir(), DataDir(), HtmlHelpDir(), and ResourcesDir().

119  {
120  wxString dir = dirIn;
121  // BUG 1577 Capitalisation of Audacity in path...
122  if( dir.EndsWith( "Audacity" ) )
123  {
124  int nChars = dir.Length() - wxString( "Audacity" ).Length();
125  dir = dir.Left( nChars ) + "audacity";
126  }
127  return dir;
128 }
wxString FileNames::MacroDir ( )
static

Definition at line 199 of file FileNames.cpp.

References DataDir(), and MkDir().

Referenced by MacroCommands::AddMacro(), MacroCommands::DeleteMacro(), MacroCommands::GetNames(), MacroCommands::MigrateLegacyChains(), MacroCommands::ReadMacro(), MacroCommands::RenameMacro(), and MacroCommands::WriteMacro().

200 {
201  return FileNames::MkDir( wxFileName( DataDir(), wxT("Macros") ).GetFullPath() );
202 }
static wxString DataDir()
Audacity user data directory.
Definition: FileNames.cpp:130
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
void FileNames::MakeNameUnique ( wxArrayString &  otherNames,
wxFileName &  newName 
)
static

Definition at line 92 of file FileNames.cpp.

Referenced by ExportMultiple::ExportMultipleByLabel(), ExportMultiple::ExportMultipleByTrack(), and AudacityProject::SaveCopyWaveTracks().

93 {
94  if (otherNames.Index(newName.GetFullName(), false) >= 0) {
95  int i=2;
96  wxString orig = newName.GetName();
97  do {
98  newName.SetName(wxString::Format(wxT("%s-%d"), orig, i));
99  i++;
100  } while (otherNames.Index(newName.GetFullName(), false) >= 0);
101  }
102  otherNames.Add(newName.GetFullName());
103 }
wxString FileNames::MkDir ( const wxString &  Str)
static

Definition at line 72 of file FileNames.cpp.

Referenced by AutoSaveDir(), DataDir(), MacroDir(), NRPDir(), AudacityApp::OnInit(), PlugInDir(), TempDir(), ThemeComponentsDir(), and ThemeDir().

73 {
74  // Behaviour of wxFileName::DirExists() and wxFileName::MkDir() has
75  // changed between wx2.6 and wx2.8, so we use static functions instead.
76  if (!wxFileName::DirExists(Str))
77  wxFileName::Mkdir(Str, 511, wxPATH_MKDIR_FULL);
78 
79  return Str;
80 }
wxString FileNames::ModulesDir ( )
static

Definition at line 253 of file FileNames.cpp.

References BaseDir().

Referenced by ModuleManager::DiscoverProviders().

254 {
255  wxFileName modulesDir(BaseDir(), wxEmptyString);
256 
257  modulesDir.AppendDir(wxT("modules"));
258 
259  return modulesDir.GetFullPath();
260 }
static wxString BaseDir()
Definition: FileNames.cpp:229
wxString FileNames::NRPDir ( )
static

Definition at line 204 of file FileNames.cpp.

References DataDir(), and MkDir().

Referenced by NRPFile().

205 {
206  return FileNames::MkDir( wxFileName( DataDir(), wxT("NRP") ).GetFullPath() );
207 }
static wxString DataDir()
Audacity user data directory.
Definition: FileNames.cpp:130
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
wxString FileNames::NRPFile ( )
static

Definition at line 209 of file FileNames.cpp.

References NRPDir().

210 {
211  return wxFileName( NRPDir(), wxT("noisegate.nrp") ).GetFullPath();
212 }
static wxString NRPDir()
Definition: FileNames.cpp:204
wxString FileNames::PathFromAddr ( void *  addr)
static

Definition at line 305 of file FileNames.cpp.

References LAT1CTOWX, name, OSINPUT, and PLATFORM_MAX_PATH.

Referenced by MP3Exporter::InitLibrary().

306 {
307  wxFileName name;
308 
309 #if defined(__WXMAC__) || defined(__WXGTK__)
310  Dl_info info;
311  if (dladdr(addr, &info)) {
312  char realname[PLATFORM_MAX_PATH + 1];
313  int len;
314  name = LAT1CTOWX(info.dli_fname);
315  len = readlink(OSINPUT(name.GetFullPath()), realname, PLATFORM_MAX_PATH);
316  if (len > 0) {
317  realname[len] = 0;
318  name.SetFullName(LAT1CTOWX(realname));
319  }
320  }
321 #elif defined(__WXMSW__) && defined(_UNICODE)
322  // The GetModuleHandlEx() function did not appear until Windows XP and
323  // GetModuleFileName() did appear until Windows 2000, so we have to
324  // check for them at runtime.
325  typedef BOOL (WINAPI *getmodulehandleex)(DWORD dwFlags, LPCWSTR lpModuleName, HMODULE* phModule);
326  typedef DWORD (WINAPI *getmodulefilename)(HMODULE hModule, LPWCH lpFilename, DWORD nSize);
327  getmodulehandleex gmhe =
328  (getmodulehandleex) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
329  "GetModuleHandleExW");
330  getmodulefilename gmfn =
331  (getmodulefilename) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
332  "GetModuleFileNameW");
333 
334  if (gmhe != NULL && gmfn != NULL) {
335  HMODULE module;
336  if (gmhe(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
337  (LPTSTR) addr,
338  &module)) {
339  TCHAR path[MAX_PATH];
340  DWORD nSize;
341 
342  nSize = gmfn(module, path, MAX_PATH);
343  if (nSize && nSize < MAX_PATH) {
344  name = LAT1CTOWX(path);
345  }
346  }
347  }
348 #endif
349 
350  return name.GetFullPath();
351 }
#define PLATFORM_MAX_PATH
Definition: Audacity.h:118
#define OSINPUT(X)
Definition: Internat.h:174
#define LAT1CTOWX(X)
Definition: Internat.h:180
const wxChar * name
Definition: Distortion.cpp:94
wxString FileNames::PlugInDir ( )
static

The user plug-in directory (not a system one)

This returns the string path to where the user may have put plug-ins if they don't have system admin rights. Under default settings, it's <DataDir>/Plug-Ins/

Definition at line 214 of file FileNames.cpp.

References DataDir(), and MkDir().

Referenced by PluginManager::FindFilesInPathList(), NyquistEffect::GetNyquistSearchPath(), NyquistEffectsModule::InstallPath(), and LadspaEffectsModule::InstallPath().

215 {
216  return FileNames::MkDir( wxFileName( DataDir(), wxT("Plug-Ins") ).GetFullPath() );
217 }
static wxString DataDir()
Audacity user data directory.
Definition: FileNames.cpp:130
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
wxString FileNames::PluginRegistry ( )
static

Definition at line 219 of file FileNames.cpp.

References DataDir().

Referenced by PluginManager::Load(), and PluginManager::Save().

220 {
221  return wxFileName( DataDir(), wxT("pluginregistry.cfg") ).GetFullPath();
222 }
static wxString DataDir()
Audacity user data directory.
Definition: FileNames.cpp:130
wxString FileNames::PluginSettings ( )
static

Definition at line 224 of file FileNames.cpp.

References DataDir().

Referenced by PluginManager::GetSettings().

225 {
226  return wxFileName( DataDir(), wxT("pluginsettings.cfg") ).GetFullPath();
227 }
static wxString DataDir()
Audacity user data directory.
Definition: FileNames.cpp:130
wxString FileNames::ResourcesDir ( )
static

Definition at line 168 of file FileNames.cpp.

References LowerCaseAppNameInPath().

Referenced by EffectEqualization::GetDefaultFileName(), InitPreferences(), and EffectEqualization::UpdateDefaultCurves().

168  {
169  wxString resourcesDir( LowerCaseAppNameInPath( wxStandardPaths::Get().GetResourcesDir() ));
170  return resourcesDir;
171 }
static wxString LowerCaseAppNameInPath(const wxString &dirIn)
Definition: FileNames.cpp:119
wxString FileNames::SelectFile ( Operation  op,
const wxString &  message,
const wxString &  default_path,
const wxString &  default_filename,
const wxString &  default_extension,
const wxString &  wildcard,
int  flags,
wxWindow *  parent 
)
static

Definition at line 411 of file FileNames.cpp.

References FileSelector(), and WithDefaultPath().

Referenced by AudacityProject::OnAudioDeviceInfo(), TimerRecordDialog::OnAutoSavePathButton_Click(), ExportCLOptions::OnBrowse(), FindDialog::OnBrowse(), KeyConfigPrefs::OnExport(), ContrastDialog::OnExport(), LabelDialog::OnExport(), FreqWindow::OnExport(), AudacityProject::OnExportLabels(), KeyConfigPrefs::OnImport(), LabelDialog::OnImport(), AudacityProject::OnImportLabels(), AudacityProject::OnImportRaw(), TagsEditor::OnLoad(), AudacityLogger::OnSave(), BenchmarkDialog::OnSave(), TagsEditor::OnSave(), and AudacityProject::SaveAs().

419 {
420  return WithDefaultPath(op, default_path, [&](const wxString &path) {
421  return FileSelector(
422  message, path, default_filename, default_extension,
423  wildcard, flags, parent, wxDefaultCoord, wxDefaultCoord);
424  });
425 }
wxString FileSelector(const wxString &title, const wxString &defaultDir, const wxString &defaultFileName, const wxString &defaultExtension, const wxString &filter, int flags, wxWindow *parent, int x, int y)
Definition: FileDialog.cpp:61
static wxString WithDefaultPath(Operation op, const wxString &defaultPath, F function)
Definition: FileNames.h:92
wxString FileNames::TempDir ( )
static

Returns the directory used for temp files.

Todo:
put a counter in here to see if it gets used a lot. if it does, then maybe we should cache the path name each time.

Definition at line 86 of file FileNames.cpp.

References gPrefs, and MkDir().

Referenced by NyquistEffect::Process().

87 {
88  return FileNames::MkDir(gPrefs->Read(wxT("/Directories/TempDir"), wxT("")));
89 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
wxString FileNames::ThemeCacheAsCee ( )
static

Definition at line 287 of file FileNames.cpp.

References ThemeDir().

Referenced by ThemeBase::CreateImageCache().

288 {
289 // DA: Theme sourcery file name.
290 #ifndef EXPERIMENTAL_DA
291  return wxFileName( ThemeDir(), wxT("ThemeAsCeeCode.h") ).GetFullPath();
292 #else
293  return wxFileName( ThemeDir(), wxT("DarkThemeAsCeeCode.h") ).GetFullPath();
294 #endif
295 }
static wxString ThemeDir()
Definition: FileNames.cpp:262
wxString FileNames::ThemeCacheHtm ( )
static

Definition at line 277 of file FileNames.cpp.

References ThemeDir().

Referenced by ThemeBase::WriteImageMap().

278 {
279  return wxFileName( ThemeDir(), wxT("ImageCache.htm") ).GetFullPath();
280 }
static wxString ThemeDir()
Definition: FileNames.cpp:262
wxString FileNames::ThemeCachePng ( )
static

Definition at line 272 of file FileNames.cpp.

References ThemeDir().

Referenced by ThemeBase::CreateImageCache(), and ThemeBase::ReadImageCache().

273 {
274  return wxFileName( ThemeDir(), wxT("ImageCache.png") ).GetFullPath();
275 }
static wxString ThemeDir()
Definition: FileNames.cpp:262
wxString FileNames::ThemeComponent ( const wxString &  Str)
static

Definition at line 297 of file FileNames.cpp.

References ThemeComponentsDir().

Referenced by ThemeBase::LoadComponents(), and ThemeBase::SaveComponents().

298 {
299  return wxFileName( ThemeComponentsDir(), Str, wxT("png") ).GetFullPath();
300 }
static wxString ThemeComponentsDir()
Definition: FileNames.cpp:267
wxString FileNames::ThemeComponentsDir ( )
static

Definition at line 267 of file FileNames.cpp.

References MkDir(), and ThemeDir().

Referenced by ThemeBase::LoadComponents(), ThemeBase::SaveComponents(), and ThemeComponent().

268 {
269  return FileNames::MkDir( wxFileName( ThemeDir(), wxT("Components") ).GetFullPath() );
270 }
static wxString ThemeDir()
Definition: FileNames.cpp:262
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
wxString FileNames::ThemeDir ( )
static

Definition at line 262 of file FileNames.cpp.

References DataDir(), and MkDir().

Referenced by ThemeCacheAsCee(), ThemeCacheHtm(), ThemeCachePng(), ThemeComponentsDir(), and ThemeImageDefsAsCee().

263 {
264  return FileNames::MkDir( wxFileName( DataDir(), wxT("Theme") ).GetFullPath() );
265 }
static wxString DataDir()
Audacity user data directory.
Definition: FileNames.cpp:130
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
wxString FileNames::ThemeImageDefsAsCee ( )
static

Definition at line 282 of file FileNames.cpp.

References ThemeDir().

Referenced by ThemeBase::WriteImageDefs().

283 {
284  return wxFileName( ThemeDir(), wxT("ThemeImageDefsAsCee.h") ).GetFullPath();
285 }
static wxString ThemeDir()
Definition: FileNames.cpp:262
void FileNames::UpdateDefaultPath ( Operation  op,
const wxString &  path 
)
static

Definition at line 399 of file FileNames.cpp.

References gPrefs.

Referenced by AudacityApp::MRUOpen(), AudacityProject::OnImport(), AudacityProject::OpenFiles(), and WithDefaultPath().

400 {
401  if (path.empty())
402  return;
403  auto key = PreferenceKey(op);
404  if (!key.empty()) {
405  gPrefs->Write(key, ::wxPathOnly(path));
406  gPrefs->Flush();
407  }
408 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
template<typename F >
static wxString FileNames::WithDefaultPath ( Operation  op,
const wxString &  defaultPath,
function 
)
inlinestatic

Definition at line 92 of file FileNames.h.

References FindDefaultPath(), and UpdateDefaultPath().

Referenced by SelectFile().

93  {
94  auto path = defaultPath;
95  if (path.empty())
96  path = FileNames::FindDefaultPath(op);
97  auto result = function(path);
98  FileNames::UpdateDefaultPath(op, result);
99  return result;
100  }
static wxString FindDefaultPath(Operation op)
Definition: FileNames.cpp:390
static void UpdateDefaultPath(Operation op, const wxString &path)
Definition: FileNames.cpp:399

The documentation for this class was generated from the following files: