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 ChainDir ()
 
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 78 of file FileNames.h.

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

Constructor & Destructor Documentation

FileNames::FileNames ( )
inlineprivate

Definition at line 114 of file FileNames.h.

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

Definition at line 115 of file FileNames.h.

115 {;};

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 223 of file FileNames.cpp.

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

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

224 {
225  wxFileName baseDir;
226 
227 #if defined(__WXMAC__)
229 
230  // Path ends for example in "Audacity.app/Contents/MacOSX"
231  //baseDir.RemoveLastDir();
232  //baseDir.RemoveLastDir();
233  // just remove the MacOSX part.
234  baseDir.RemoveLastDir();
235 #elif defined(__WXMSW__)
236  // Don't use wxStandardPaths::Get().GetDataDir() since it removes
237  // the "Debug" directory in debug builds.
239 #else
240  // Linux goes into /*prefix*/share/audacity/
241  baseDir = FileNames::LowerCaseAppNameInPath(wxStandardPaths::Get().GetDataDir());
242 #endif
243 
244  return baseDir.GetPath();
245 }
static const wxString & GetExecutablePath()
static wxString LowerCaseAppNameInPath(const wxString &dirIn)
Definition: FileNames.cpp:119
wxString FileNames::ChainDir ( )
static

Definition at line 193 of file FileNames.cpp.

References DataDir(), and MkDir().

Referenced by BatchCommands::AddChain(), BatchCommands::DeleteChain(), BatchCommands::GetNames(), BatchCommands::ReadChain(), BatchCommands::RenameChain(), and BatchCommands::WriteChain().

194 {
195  return FileNames::MkDir( wxFileName( DataDir(), wxT("Chains") ).GetFullPath() );
196 }
static wxString DataDir()
Audacity user data directory.
Definition: FileNames.cpp:130
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
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(), and PluginManager::DropFile().

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(), ChainDir(), EffectEqualization::GetDefaultFileName(), InitPreferences(), EffectEqualization::LoadCurves(), Tags::LoadGenres(), NRPDir(), TagsEditor::OnEdit(), EditCurvesDialog::OnExport(), EditCurvesDialog::OnImport(), TagsEditor::OnLoad(), EditCurvesDialog::OnOK(), TagsEditor::OnReset(), TagsEditor::OnSave(), PlugInDir(), PluginRegistry(), PluginSettings(), AboutDialog::PopulateInformationPage(), NyquistEffect::Process(), 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 348 of file FileNames.cpp.

References gPrefs.

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

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

Definition at line 384 of file FileNames.cpp.

References DefaultToDocumentsFolder().

Referenced by BatchCommands::BuildCleanFileName(), BatchProcessDialog::OnApplyToFiles(), AudacityProject::ShowOpenDialog(), and WithDefaultPath().

385 {
386  auto key = PreferenceKey(op);
387  if (key.empty())
388  return wxString{};
389  else
390  return DefaultToDocumentsFolder(key).GetPath();
391 }
static wxFileNameWrapper DefaultToDocumentsFolder(const wxString &preference)
Definition: FileNames.cpp:348
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::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 }
void FileNames::MakeNameUnique ( wxArrayString &  otherNames,
wxFileName &  newName 
)
static

Definition at line 92 of file FileNames.cpp.

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

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(), ChainDir(), DataDir(), 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 247 of file FileNames.cpp.

References BaseDir().

Referenced by ModuleManager::DiscoverProviders().

248 {
249  wxFileName modulesDir(BaseDir(), wxEmptyString);
250 
251  modulesDir.AppendDir(wxT("modules"));
252 
253  return modulesDir.GetFullPath();
254 }
static wxString BaseDir()
Definition: FileNames.cpp:223
wxString FileNames::NRPDir ( )
static

Definition at line 198 of file FileNames.cpp.

References DataDir(), and MkDir().

Referenced by NRPFile().

199 {
200  return FileNames::MkDir( wxFileName( DataDir(), wxT("NRP") ).GetFullPath() );
201 }
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 203 of file FileNames.cpp.

References NRPDir().

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

Definition at line 299 of file FileNames.cpp.

References LAT1CTOWX, name, OSINPUT, and PLATFORM_MAX_PATH.

Referenced by MP3Exporter::InitLibrary().

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

References DataDir(), and MkDir().

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

209 {
210  return FileNames::MkDir( wxFileName( DataDir(), wxT("Plug-Ins") ).GetFullPath() );
211 }
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 213 of file FileNames.cpp.

References DataDir().

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

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

Definition at line 218 of file FileNames.cpp.

References DataDir().

Referenced by PluginManager::GetSettings().

219 {
220  return wxFileName( DataDir(), wxT("pluginsettings.cfg") ).GetFullPath();
221 }
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 405 of file FileNames.cpp.

References 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().

413 {
414  return WithDefaultPath(op, default_path, [&](const wxString &path) {
415  return FileSelector(
416  message, path, default_filename, default_extension,
417  wildcard, flags, parent, wxDefaultCoord, wxDefaultCoord);
418  });
419 }
static wxString WithDefaultPath(Operation op, const wxString &defaultPath, F function)
Definition: FileNames.h:91
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 }
wxFileConfig * gPrefs
Definition: Prefs.cpp:72
static wxString MkDir(const wxString &Str)
Definition: FileNames.cpp:72
wxString FileNames::ThemeCacheAsCee ( )
static

Definition at line 281 of file FileNames.cpp.

References ThemeDir().

Referenced by ThemeBase::CreateImageCache().

282 {
283 // DA: Theme sourcery file name.
284 #ifndef EXPERIMENTAL_DA
285  return wxFileName( ThemeDir(), wxT("ThemeAsCeeCode.h") ).GetFullPath();
286 #else
287  return wxFileName( ThemeDir(), wxT("DarkThemeAsCeeCode.h") ).GetFullPath();
288 #endif
289 }
static wxString ThemeDir()
Definition: FileNames.cpp:256
wxString FileNames::ThemeCacheHtm ( )
static

Definition at line 271 of file FileNames.cpp.

References ThemeDir().

Referenced by ThemeBase::WriteImageMap().

272 {
273  return wxFileName( ThemeDir(), wxT("ImageCache.htm") ).GetFullPath();
274 }
static wxString ThemeDir()
Definition: FileNames.cpp:256
wxString FileNames::ThemeCachePng ( )
static

Definition at line 266 of file FileNames.cpp.

References ThemeDir().

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

267 {
268  return wxFileName( ThemeDir(), wxT("ImageCache.png") ).GetFullPath();
269 }
static wxString ThemeDir()
Definition: FileNames.cpp:256
wxString FileNames::ThemeComponent ( const wxString &  Str)
static

Definition at line 291 of file FileNames.cpp.

References ThemeComponentsDir().

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

292 {
293  return wxFileName( ThemeComponentsDir(), Str, wxT("png") ).GetFullPath();
294 }
static wxString ThemeComponentsDir()
Definition: FileNames.cpp:261
wxString FileNames::ThemeComponentsDir ( )
static

Definition at line 261 of file FileNames.cpp.

References MkDir(), and ThemeDir().

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

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

Definition at line 256 of file FileNames.cpp.

References DataDir(), and MkDir().

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

257 {
258  return FileNames::MkDir( wxFileName( DataDir(), wxT("Theme") ).GetFullPath() );
259 }
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 276 of file FileNames.cpp.

References ThemeDir().

Referenced by ThemeBase::WriteImageDefs().

277 {
278  return wxFileName( ThemeDir(), wxT("ThemeImageDefsAsCee.h") ).GetFullPath();
279 }
static wxString ThemeDir()
Definition: FileNames.cpp:256
void FileNames::UpdateDefaultPath ( Operation  op,
const wxString &  path 
)
static

Definition at line 393 of file FileNames.cpp.

References gPrefs.

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

394 {
395  if (path.empty())
396  return;
397  auto key = PreferenceKey(op);
398  if (!key.empty()) {
399  gPrefs->Write(key, ::wxPathOnly(path));
400  gPrefs->Flush();
401  }
402 }
wxFileConfig * gPrefs
Definition: Prefs.cpp:72
template<typename F >
static wxString FileNames::WithDefaultPath ( Operation  op,
const wxString &  defaultPath,
function 
)
inlinestatic

Definition at line 91 of file FileNames.h.

References FindDefaultPath(), and UpdateDefaultPath().

Referenced by SelectFile().

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

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