Audacity  3.0.3
FileNames.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  FileNames.cpp
6 
7  James Crook
8 
9 ********************************************************************//********************************************************************/
22 
23 #include "FileNames.h"
24 
25 
26 
27 #include <memory>
28 
29 #include <wx/defs.h>
30 #include <wx/filename.h>
31 #include <wx/intl.h>
32 #include <wx/stdpaths.h>
33 #include "BasicUI.h"
34 #include "Prefs.h"
35 #include "Internat.h"
36 #include "ModuleConstants.h"
37 #include "PlatformCompatibility.h"
38 #include "wxFileNameWrapper.h"
39 
40 #if defined(__WXMAC__) || defined(__WXGTK__)
41 #include <dlfcn.h>
42 #endif
43 
44 #if defined(__WXMSW__)
45 #include <windows.h>
46 #endif
47 
48 static wxString gDataDir;
49 
51  FileNames::AllFiles{ XO("All files"), { wxT("") } }
52  /* i18n-hint an Audacity project is the state of the program, stored as
53  files that can be reopened to resume the session later */
54  , FileNames::AudacityProjects{ XO("AUP3 project files"), { wxT("aup3") }, true }
56 #if defined(__WXMSW__)
57  XO("Dynamically Linked Libraries"), { wxT("dll") }, true
58 #elif defined(__WXMAC__)
59  XO("Dynamic Libraries"), { wxT("dylib") }, true
60 #else
61  XO("Dynamically Linked Libraries"), { wxT("so*") }, true
62 #endif
63  }
64  , FileNames::TextFiles{ XO("Text files"), { wxT("txt") }, true }
65  , FileNames::XMLFiles{ XO("XML files"), { wxT("xml"), wxT("XML") }, true }
66 ;
67 
68 wxString FileNames::FormatWildcard( const FileTypes &fileTypes )
69 {
70  // |-separated list of:
71  // [ Description,
72  // ( if appendExtensions, then ' (', globs, ')' ),
73  // '|',
74  // globs ]
75  // where globs is a ;-separated list of filename patterns, which are
76  // '*' for an empty extension, else '*.' then the extension
77  // Only the part before | is displayed in the choice drop-down of file
78  // dialogs
79  //
80  // Exceptional case: if there is only one type and its description is empty,
81  // then just give the globs with no |
82  // Another exception: an empty description, when there is more than one
83  // type, is replaced with a default
84  // Another exception: if an extension contains a dot, it is interpreted as
85  // not really an extension, but a literal filename
86 
87  const wxString dot{ '.' };
88  const auto makeGlobs = [&dot]( const FileExtensions &extensions ){
89  wxString globs;
90  for ( const auto &extension: extensions ) {
91  if ( !globs.empty() )
92  globs += ';';
93  if ( extension.Contains( dot ) )
94  globs += extension;
95  else {
96  globs += '*';
97  if ( !extension.empty() ) {
98  globs += '.';
99  globs += extension;
100  }
101  }
102  }
103  return globs;
104  };
105 
106  const auto defaultDescription = []( const FileExtensions &extensions ){
107  // Assume extensions is not empty
108  wxString exts = extensions[0];
109  for (size_t ii = 1, size = extensions.size(); ii < size; ++ii ) {
110  exts += XO(", ").Translation();
111  exts += extensions[ii];
112  }
113  /* i18n-hint a type or types such as "txt" or "txt, xml" will be
114  substituted for %s */
115  return XO("%s files").Format( exts );
116  };
117 
118  if ( fileTypes.size() == 1 && fileTypes[0].description.empty() ) {
119  return makeGlobs( fileTypes[0].extensions );
120  }
121  else {
122  wxString result;
123  for ( const auto &fileType : fileTypes ) {
124  const auto &extensions = fileType.extensions;
125  if (extensions.empty())
126  continue;
127 
128  if (!result.empty())
129  result += '|';
130 
131  const auto globs = makeGlobs( extensions );
132 
133  auto mask = fileType.description;
134  if ( mask.empty() )
135  mask = defaultDescription( extensions );
136  if ( fileType.appendExtensions )
137  mask.Join( XO("(%s)").Format( globs ), " " );
138  result += mask.Translation();
139  result += '|';
140  result += globs;
141  }
142  return result;
143  }
144 }
145 
147  const FilePath& file1, const FilePath& file2, bool overwrite)
148 {
149 #ifdef __WXMSW__
150 
151  // workaround not needed
152  return wxCopyFile(file1, file2, overwrite);
153 
154 #else
155  // PRL: Compensate for buggy wxCopyFile that returns false success,
156  // which was a cause of case 4 in comment 10 of
157  // http://bugzilla.audacityteam.org/show_bug.cgi?id=1759
158  // Destination file was created, but was empty
159  // Bug was introduced after wxWidgets 2.8.12 at commit
160  // 0597e7f977c87d107e24bf3e95ebfa3d60efc249 of wxWidgets repo
161 
162  bool existed = wxFileExists(file2);
163  bool result = wxCopyFile(file1, file2, overwrite) &&
164  wxFile{ file1 }.Length() == wxFile{ file2 }.Length();
165  if (!result && !existed)
166  wxRemoveFile(file2);
167  return result;
168 
169 #endif
170 }
171 
172 bool FileNames::HardLinkFile( const FilePath& file1, const FilePath& file2 )
173 {
174 #ifdef __WXMSW__
175 
176  // Fix forced ASCII conversions and wrong argument order - MJB - 29/01/2019
177  //return ::CreateHardLinkA( file1.c_str(), file2.c_str(), NULL );
178  return ( 0 != ::CreateHardLink( file2, file1, NULL ) );
179 
180 #else
181 
182  return 0 == ::link( file1.c_str(), file2.c_str() );
183 
184 #endif
185 }
186 
187 wxString FileNames::MkDir(const wxString &Str)
188 {
189  // Behaviour of wxFileName::DirExists() and wxFileName::MkDir() has
190  // changed between wx2.6 and wx2.8, so we use static functions instead.
191  if (!wxFileName::DirExists(Str))
192  wxFileName::Mkdir(Str, 511, wxPATH_MKDIR_FULL);
193 
194  return Str;
195 }
196 
197 // originally an ExportMultipleDialog method. Append suffix if newName appears in otherNames.
198 void FileNames::MakeNameUnique(FilePaths &otherNames,
199  wxFileName &newName)
200 {
201  if (otherNames.Index(newName.GetFullName(), false) >= 0) {
202  int i=2;
203  wxString orig = newName.GetName();
204  do {
205  newName.SetName(wxString::Format(wxT("%s-%d"), orig, i));
206  i++;
207  } while (otherNames.Index(newName.GetFullName(), false) >= 0);
208  }
209  otherNames.push_back(newName.GetFullName());
210 }
211 
212 // The APP name has upercase first letter (so that Quit Audacity is correctly
213 // capitalised on Mac, but we want lower case APP name in paths.
214 // This function does that substitution, IF the last component of
215 // the path is 'Audacity'.
216 wxString FileNames::LowerCaseAppNameInPath( const wxString & dirIn){
217  wxString dir = dirIn;
218  // BUG 1577 Capitalisation of Audacity in path...
219  if( dir.EndsWith( "Audacity" ) )
220  {
221  int nChars = dir.length() - wxString( "Audacity" ).length();
222  dir = dir.Left( nChars ) + "audacity";
223  }
224  return dir;
225 }
226 
228 {
229  // LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict
230  // between wxStandardPaths and wxConfig under Linux. The latter
231  // creates a normal file as "$HOME/.audacity", while the former
232  // expects the ".audacity" portion to be a directory.
233  if (gDataDir.empty())
234  {
235  // If there is a directory "Portable Settings" relative to the
236  // executable's EXE file, the prefs are stored in there, otherwise
237  // the prefs are stored in the user data dir provided by the OS.
238  wxFileName exePath(PlatformCompatibility::GetExecutablePath());
239 #if defined(__WXMAC__)
240  // Path ends for example in "Audacity.app/Contents/MacOSX"
241  //exePath.RemoveLastDir();
242  //exePath.RemoveLastDir();
243  // just remove the MacOSX part.
244  exePath.RemoveLastDir();
245 #endif
246  wxFileName portablePrefsPath(exePath.GetPath(), wxT("Portable Settings"));
247 
248  if (::wxDirExists(portablePrefsPath.GetFullPath()))
249  {
250  // Use "Portable Settings" folder
251  gDataDir = portablePrefsPath.GetFullPath();
252  } else
253  {
254  // Use OS-provided user data dir folder
255  wxString dataDir( LowerCaseAppNameInPath( wxStandardPaths::Get().GetUserDataDir() ));
256 #if defined( __WXGTK__ )
257  dataDir = dataDir + wxT("-data");
258 #endif
259  gDataDir = FileNames::MkDir(dataDir);
260  }
261  }
262  return gDataDir;
263 }
264 
266  wxString resourcesDir( LowerCaseAppNameInPath( wxStandardPaths::Get().GetResourcesDir() ));
267  return resourcesDir;
268 }
269 
271 {
272 #if defined(__WXMAC__)
273  wxFileName exePath(PlatformCompatibility::GetExecutablePath());
274  // Path ends for example in "Audacity.app/Contents/MacOSX"
275  //exePath.RemoveLastDir();
276  //exePath.RemoveLastDir();
277  // just remove the MacOSX part.
278  exePath.RemoveLastDir();
279 
280  //for mac this puts us within the .app: Audacity.app/Contents/SharedSupport/
281  return wxFileName( exePath.GetPath()+wxT("/help/manual"), wxEmptyString ).GetFullPath();
282 #else
283  //linux goes into /*prefix*/share/audacity/
284  //windows (probably) goes into the dir containing the .exe
285  wxString dataDir = FileNames::LowerCaseAppNameInPath( wxStandardPaths::Get().GetDataDir());
286  return wxFileName( dataDir+wxT("/help/manual"), wxEmptyString ).GetFullPath();
287 #endif
288 }
289 
291 {
292  // Don't force creation of it
293  return wxFileName{ DataDir(), wxT("Chains") }.GetFullPath();
294 }
295 
297 {
298  return FileNames::MkDir( wxFileName( DataDir(), wxT("Macros") ).GetFullPath() );
299 }
300 
302 {
303  return FileNames::MkDir( wxFileName( DataDir(), wxT("NRP") ).GetFullPath() );
304 }
305 
307 {
308  return wxFileName( NRPDir(), wxT("noisegate.nrp") ).GetFullPath();
309 }
310 
312 {
313  return FileNames::MkDir( wxFileName( DataDir(), wxT("Plug-Ins") ).GetFullPath() );
314 }
315 
317 {
318  return wxFileName( DataDir(), wxT("pluginregistry.cfg") ).GetFullPath();
319 }
320 
322 {
323  return wxFileName( DataDir(), wxT("pluginsettings.cfg") ).GetFullPath();
324 }
325 
327 {
328  wxFileName baseDir;
329 
330 #if defined(__WXMAC__)
332 
333  // Path ends for example in "Audacity.app/Contents/MacOSX"
334  //baseDir.RemoveLastDir();
335  //baseDir.RemoveLastDir();
336  // just remove the MacOSX part.
337  baseDir.RemoveLastDir();
338 #elif defined(__WXMSW__)
339  // Don't use wxStandardPaths::Get().GetDataDir() since it removes
340  // the "Debug" directory in debug builds.
342 #else
343  // Linux goes into /*prefix*/share/audacity/
344  baseDir = FileNames::LowerCaseAppNameInPath(wxStandardPaths::Get().GetPluginsDir());
345 #endif
346 
347  return baseDir.GetPath();
348 }
349 
351 {
352  wxFileName modulesDir(BaseDir(), wxEmptyString);
353 
354  modulesDir.AppendDir(wxT("modules"));
355 
356  return modulesDir.GetFullPath();
357 }
358 
359 //
360 // Returns the full path of program module (.exe, .dll, .so, .dylib) containing address
361 //
363 {
364  wxFileName name;
365 
366 #if defined(__WXMAC__) || defined(__WXGTK__)
367 #define OSFILENAME(X) ((char *) (const char *)(X).fn_str())
368 #define OSINPUT(X) OSFILENAME(X)
369  Dl_info info;
370  if (dladdr(addr, &info)) {
371  char realname[PLATFORM_MAX_PATH + 1];
372  int len;
373  name = LAT1CTOWX(info.dli_fname);
374  len = readlink(OSINPUT(name.GetFullPath()), realname, PLATFORM_MAX_PATH);
375  if (len > 0) {
376  realname[len] = 0;
377  name.SetFullName(LAT1CTOWX(realname));
378  }
379  }
380 #elif defined(__WXMSW__) && defined(_UNICODE)
381  // The GetModuleHandlEx() function did not appear until Windows XP and
382  // GetModuleFileName() did appear until Windows 2000, so we have to
383  // check for them at runtime.
384  typedef BOOL (WINAPI *getmodulehandleex)(DWORD dwFlags, LPCWSTR lpModuleName, HMODULE* phModule);
385  typedef DWORD (WINAPI *getmodulefilename)(HMODULE hModule, LPWCH lpFilename, DWORD nSize);
386  getmodulehandleex gmhe =
387  (getmodulehandleex) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
388  "GetModuleHandleExW");
389  getmodulefilename gmfn =
390  (getmodulefilename) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
391  "GetModuleFileNameW");
392 
393  if (gmhe != NULL && gmfn != NULL) {
394  HMODULE module;
395  if (gmhe(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
396  (LPTSTR) addr,
397  &module)) {
398  TCHAR path[MAX_PATH];
399  DWORD nSize;
400 
401  nSize = gmfn(module, path, MAX_PATH);
402  if (nSize && nSize < MAX_PATH) {
403  name = LAT1CTOWX(path);
404  }
405  }
406  }
407 #endif
408 
409  return name.GetFullPath();
410 }
411 
412 
414  if( Path.IsEmpty() )
415  return false;
416 #ifndef __WIN32__
417  return true;
418 #else
419  wxFileNameWrapper filePath( Path );
420  return filePath.DirExists() && !filePath.FileExists();
421 #endif
422 }
423 
424 wxFileNameWrapper FileNames::DefaultToDocumentsFolder(const wxString &preference)
425 {
426  wxFileNameWrapper result;
427 
428 #ifdef __WIN32__
429  wxFileName defaultPath( wxStandardPaths::Get().GetDocumentsDir(), "" );
430 
431  defaultPath.AppendDir( AppName );
432  result.SetPath( gPrefs->Read( preference, defaultPath.GetPath( wxPATH_GET_VOLUME ) ) );
433 
434  // MJB: Bug 1899 & Bug 2007. Only create directory if the result is the default path
435  bool bIsDefaultPath = result == defaultPath;
436  if( !bIsDefaultPath )
437  {
438  // IF the prefs directory doesn't exist - (Deleted by our user perhaps?)
439  // or exists as a file
440  // THEN fallback to using the default directory.
441  bIsDefaultPath = !IsPathAvailable( result.GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR ) );
442  if( bIsDefaultPath )
443  {
444  result.SetPath( defaultPath.GetPath( wxPATH_GET_VOLUME ) );
445  // Don't write to gPrefs.
446  // We typically do it later, (if directory actually gets used)
447  }
448  }
449  if ( bIsDefaultPath )
450  {
451  // The default path might not exist since it is a sub-directory of 'Documents'
452  // There is no error if the path could not be created. That's OK.
453  // The dialog that Audacity offers will allow the user to select a valid directory.
454  result.Mkdir(0755, wxPATH_MKDIR_FULL);
455  }
456 #else
457  result.AssignHomeDir();
458  result.SetPath(gPrefs->Read( preference, result.GetPath() + "/Documents"));
459 #endif
460 
461  return result;
462 }
463 
465 {
466  wxString key;
467  switch (op) {
468  case FileNames::Operation::Temp:
469  key = wxT("/Directories/TempDir"); break;
470  case FileNames::Operation::Presets:
471  key = wxT("/Presets/Path"); break;
472  case FileNames::Operation::Open:
473  key = wxT("/Directories/Open"); break;
474  case FileNames::Operation::Save:
475  key = wxT("/Directories/Save"); break;
476  case FileNames::Operation::Import:
477  key = wxT("/Directories/Import"); break;
478  case FileNames::Operation::Export:
479  key = wxT("/Directories/Export"); break;
480  case FileNames::Operation::MacrosOut:
481  key = wxT("/Directories/MacrosOut"); break;
482  case FileNames::Operation::_None:
483  default:
484  break;
485  }
486 
487  switch (type) {
488  case FileNames::PathType::User:
489  key += "/Default"; break;
490  case FileNames::PathType::LastUsed:
491  key += "/LastUsed"; break;
492  case FileNames::PathType::_None:
493  default:
494  break;
495  }
496 
497  return key;
498 }
499 
501 {
502  auto key = PreferenceKey(op, PathType::User);
503 
504  if (key.empty())
505  return wxString{};
506 
507  // If the user specified a default path, then use that
508  FilePath path = gPrefs->Read(key, wxT(""));
509  if (!path.empty()) {
510  return path;
511  }
512 
513  // Maybe the last used path is available
514  key = PreferenceKey(op, PathType::LastUsed);
515  path = gPrefs->Read(key, wxT(""));
516  if (!path.empty()) {
517  return path;
518  }
519 
520  // Last resort is to simply return the default folder
521  return DefaultToDocumentsFolder("").GetPath();
522 }
523 
524 void FileNames::UpdateDefaultPath(Operation op, const FilePath &path)
525 {
526  if (path.empty())
527  return;
528  wxString key;
529  if (op == Operation::Temp) {
530  key = PreferenceKey(op, PathType::_None);
531  }
532  else {
533  key = PreferenceKey(op, PathType::LastUsed);
534  }
535  if (!key.empty()) {
536  gPrefs->Write(key, path);
537  gPrefs->Flush();
538  }
539 }
540 
541 bool FileNames::IsMidi(const FilePath &fName)
542 {
543  const auto extension = fName.AfterLast(wxT('.'));
544  return
545  extension.IsSameAs(wxT("gro"), false) ||
546  extension.IsSameAs(wxT("midi"), false) ||
547  extension.IsSameAs(wxT("mid"), false);
548 }
549 
551 
553 {
554  return sAudacityPathList;
555 }
556 
558 {
559  sAudacityPathList = std::move( list );
560 }
561 
562 // static
563 void FileNames::AddUniquePathToPathList(const FilePath &pathArg,
564  FilePaths &pathList)
565 {
566  wxFileNameWrapper pathNorm { pathArg };
567  pathNorm.Normalize();
568  const wxString newpath{ pathNorm.GetFullPath() };
569 
570  for(const auto &path : pathList) {
571  if (pathNorm == wxFileNameWrapper{ path })
572  return;
573  }
574 
575  pathList.push_back(newpath);
576 }
577 
578 // static
579 void FileNames::AddMultiPathsToPathList(const wxString &multiPathStringArg,
580  FilePaths &pathList)
581 {
582  wxString multiPathString(multiPathStringArg);
583  while (!multiPathString.empty()) {
584  wxString onePath = multiPathString.BeforeFirst(wxPATH_SEP[0]);
585  multiPathString = multiPathString.AfterFirst(wxPATH_SEP[0]);
586  AddUniquePathToPathList(onePath, pathList);
587  }
588 }
589 
590 #include <wx/log.h>
591 
592 // static
593 void FileNames::FindFilesInPathList(const wxString & pattern,
594  const FilePaths & pathList,
595  FilePaths & results,
596  int flags)
597 {
598  wxLogNull nolog;
599 
600  if (pattern.empty()) {
601  return;
602  }
603 
605 
606  for(size_t i = 0; i < pathList.size(); i++) {
607  ff = pathList[i] + wxFILE_SEP_PATH + pattern;
608  wxDir::GetAllFiles(ff.GetPath(), &results, ff.GetFullName(), flags);
609  }
610 }
611 
613  const TranslatableString & message)
614 {
615  bool status = wxFileName::IsDirWritable(path);
616 
617  if (!status)
618  {
619  using namespace BasicUI;
621  message +
622  XO("\n%s does not have write permissions.").Format(path),
624  .Caption(XO("Error"))
625  .IconStyle(Icon::Error)
626  .ButtonStyle(Button::Ok)
627  );
628  }
629 
630  return status;
631 }
632 
633 // Using this with wxStringArray::Sort will give you a list that
634 // is alphabetical, without depending on case. If you use the
635 // default sort, you will get strings with 'R' before 'a', because it is in caps.
636 int FileNames::CompareNoCase(const wxString& first, const wxString& second)
637 {
638  return first.CmpNoCase(second);
639 }
640 
641 // Create a unique filename using the passed prefix and suffix
642 wxString FileNames::CreateUniqueName(const wxString &prefix,
643  const wxString &suffix /* = wxEmptyString */)
644 {
645  static int count = 0;
646 
647  return wxString::Format(wxT("%s %s N-%i.%s"),
648  prefix,
649  wxDateTime::Now().Format(wxT("%Y-%m-%d %H-%M-%S")),
650  ++count,
651  suffix);
652 }
653 
655 {
656  return wxT("aup3unsaved");
657 }
658 
659 // How to detect whether the file system of a path is FAT
660 // No apparent way to do it with wxWidgets
661 #if defined(__DARWIN__)
662 #include <sys/mount.h>
663 bool FileNames::IsOnFATFileSystem(const FilePath &path)
664 {
665  struct statfs fs;
666  if (statfs(wxPathOnly(path).c_str(), &fs))
667  // Error from statfs
668  return false;
669  return 0 == strcmp(fs.f_fstypename, "msdos");
670 }
671 #elif defined(__linux__)
672 #include <sys/statfs.h>
673 #include "/usr/include/linux/magic.h"
674 bool FileNames::IsOnFATFileSystem(const FilePath &path)
675 {
676  struct statfs fs;
677  if (statfs(wxPathOnly(path).c_str(), &fs))
678  // Error from statfs
679  return false;
680  return fs.f_type == MSDOS_SUPER_MAGIC;
681 }
682 #elif defined(_WIN32)
683 #include <fileapi.h>
684 bool FileNames::IsOnFATFileSystem(const FilePath &path)
685 {
686  wxFileNameWrapper fileName{path};
687  if (!fileName.HasVolume())
688  return false;
689  auto volume = AbbreviatePath(fileName) + wxT("\\");
690  DWORD volumeFlags;
691  wxChar volumeType[64];
692  if (!::GetVolumeInformationW(
693  volume.wc_str(), NULL, 0, NULL, NULL,
694  &volumeFlags,
695  volumeType,
696  WXSIZEOF(volumeType)))
697  return false;
698  wxString type(volumeType);
699  if (type == wxT("FAT") || type == wxT("FAT32"))
700  return true;
701  return false;
702 }
703 #else
704 bool FileNames::IsOnFATFileSystem(const FilePath &path)
705 {
706  return false;
707 }
708 #endif
709 
710 wxString FileNames::AbbreviatePath( const wxFileName &fileName )
711 {
712  wxString target;
713 #ifdef __WXMSW__
714 
715  // Drive letter plus colon
716  target = fileName.GetVolume() + wxT(":");
717 
718 #else
719 
720  // Shorten the path, arbitrarily to 3 components
721  auto path = fileName;
722  path.SetFullName(wxString{});
723  while(path.GetDirCount() > 3)
724  path.RemoveLastDir();
725  target = path.GetFullPath();
726 
727 #endif
728  return target;
729 }
FileNames::ResourcesDir
FILES_API FilePath ResourcesDir()
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
AppName
const std::wstring AppName
This program's name.
Definition: ModuleConstants.cpp:15
FileNames::UnsavedProjectExtension
FILES_API wxString UnsavedProjectExtension()
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
BasicUI::MessageBoxOptions
Definition: BasicUI.h:91
FileNames::MakeNameUnique
FILES_API void MakeNameUnique(FilePaths &otherNames, wxFileName &newName)
OSINPUT
#define OSINPUT(X)
Definition: SelectFile.h:55
wxFileNameWrapper.h
FileNames::MkDir
FILES_API wxString MkDir(const wxString &Str)
wxFileNameWrapper
Definition: wxFileNameWrapper.h:21
FileNames::FindDefaultPath
FILES_API FilePath FindDefaultPath(Operation op)
FileNames::AbbreviatePath
FILES_API wxString AbbreviatePath(const wxFileName &fileName)
Give enough of the path to identify the device. (On Windows, drive letter plus ':')
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
BasicUI::ShowMessageBox
MessageBoxResult ShowMessageBox(const TranslatableString &message, MessageBoxOptions options={})
Show a modal message box with either Ok or Yes and No, and optionally Cancel.
Definition: BasicUI.h:248
FileNames::NRPDir
FILES_API FilePath NRPDir()
FileNames::UpdateDefaultPath
FILES_API void UpdateDefaultPath(Operation op, const FilePath &path)
Format
Abstract base class used in importing a file.
XO
#define XO(s)
Definition: Internat.h:31
FileNames::XMLFiles
FILES_API const FileType XMLFiles
Definition: FileNames.h:74
FileNames::PlugInDir
FILES_API FilePath PlugInDir()
The user plug-in directory (not a system one)
FileNames::DefaultToDocumentsFolder
FILES_API wxFileNameWrapper DefaultToDocumentsFolder(const wxString &preference)
FileNames::PluginSettings
FILES_API FilePath PluginSettings()
FileNames::AllFiles
FILES_API const FileType AllFiles
Definition: FileNames.h:71
wxArrayStringEx
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
Definition: wxArrayStringEx.h:18
FileNames::PreferenceKey
FILES_API wxString PreferenceKey(FileNames::Operation op, FileNames::PathType type)
FileNames::AudacityProjects
FILES_API const FileType AudacityProjects
Definition: FileNames.h:72
FileNames::AddUniquePathToPathList
FILES_API void AddUniquePathToPathList(const FilePath &path, FilePaths &pathList)
FileNames::LegacyChainDir
FILES_API FilePath LegacyChainDir()
FileNames::DataDir
FILES_API FilePath DataDir()
Audacity user data directory.
FileNames::PluginRegistry
FILES_API FilePath PluginRegistry()
FileNames::IsOnFATFileSystem
FILES_API bool IsOnFATFileSystem(const FilePath &path)
FileNames::IsMidi
FILES_API bool IsMidi(const FilePath &fName)
FileNames::PathFromAddr
FILES_API FilePath PathFromAddr(void *addr)
FilePath
wxString FilePath
Definition: Project.h:20
FileNames::SetAudacityPathList
FILES_API void SetAudacityPathList(FilePaths list)
BasicUI::Get
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:26
FileNames::TextFiles
FILES_API const FileType TextFiles
Definition: FileNames.h:74
FileTypes
std::vector< FileNames::FileType > FileTypes
Definition: SelectFile.h:23
name
const TranslatableString name
Definition: Distortion.cpp:98
FileNames::CreateUniqueName
FILES_API wxString CreateUniqueName(const wxString &prefix, const wxString &suffix=wxEmptyString)
FileNames::ModulesDir
FILES_API FilePath ModulesDir()
FileNames::FindFilesInPathList
FILES_API void FindFilesInPathList(const wxString &pattern, const FilePaths &pathList, FilePaths &results, int flags=wxDIR_FILES)
FileNames::IsPathAvailable
FILES_API bool IsPathAvailable(const FilePath &Path)
ModuleConstants.h
FileNames::PathType
PathType
Definition: FileNames.h:163
FileNames::NRPFile
FILES_API FilePath NRPFile()
BasicUI.h
Toolkit-neutral facade for basic user interface services.
Internat.h
FileNames::AddMultiPathsToPathList
FILES_API void AddMultiPathsToPathList(const wxString &multiPathString, FilePaths &pathList)
LAT1CTOWX
#define LAT1CTOWX(X)
Definition: Internat.h:160
FileNames::BaseDir
FILES_API FilePath BaseDir()
gDataDir
static wxString gDataDir
Definition: FileNames.cpp:48
FileNames::LowerCaseAppNameInPath
FILES_API wxString LowerCaseAppNameInPath(const wxString &dirIn)
BasicUI
Definition: Export.h:39
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
BasicUI::MessageBoxOptions::Caption
MessageBoxOptions && Caption(TranslatableString caption_) &&
Definition: BasicUI.h:98
PlatformCompatibility.h
FileNames::WritableLocationCheck
FILES_API bool WritableLocationCheck(const FilePath &path, const TranslatableString &message)
Check location on writable access and return true if checked successfully.
FileNames::AudacityPathList
FILES_API const FilePaths & AudacityPathList()
A list of directories that should be searched for Audacity files (plug-ins, help files,...
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: CommandManager.cpp:201
FileNames::DynamicLibraries
FILES_API const FileType DynamicLibraries
Definition: FileNames.h:73
FileNames.h
FileNames::HtmlHelpDir
FILES_API FilePath HtmlHelpDir()
PLATFORM_MAX_PATH
#define PLATFORM_MAX_PATH
Definition: FileNames.h:22
FileNames::MacroDir
FILES_API FilePath MacroDir()
FileNames::CompareNoCase
FILES_API int CompareNoCase(const wxString &first, const wxString &second)
FileNames::DoCopyFile
FILES_API bool DoCopyFile(const FilePath &file1, const FilePath &file2, bool overwrite=true)
Prefs.h
FileNames::FormatWildcard
FILES_API wxString FormatWildcard(const FileTypes &fileTypes)
FileNames::HardLinkFile
FILES_API bool HardLinkFile(const FilePath &file1, const FilePath &file2)
PlatformCompatibility::GetExecutablePath
static const FilePath & GetExecutablePath()
Definition: PlatformCompatibility.cpp:33
exts
static const auto exts
Definition: ImportAUP.cpp:57
FileNames::FileType
Definition: FileNames.h:52
sAudacityPathList
static FilePaths sAudacityPathList
Definition: FileNames.cpp:550
Journal::WindowPaths::Path
Identifier Path
Definition: JournalWindowPaths.h:24
FileNames::Operation
Operation
Definition: FileNames.h:147