Audacity  2.2.2
FileException.cpp
Go to the documentation of this file.
1 //
2 // FileException.cpp
3 //
4 //
5 // Created by Paul Licameli on 11/22/16.
6 //
7 //
8 
9 #include "Audacity.h"
10 #include "FileException.h"
11 #include "Internat.h"
12 #include "Prefs.h"
13 
15 {
16 }
17 
19 {
20  wxString format;
21  switch (cause) {
22  case Cause::Open:
23  format = _("Audacity failed to open a file in %s.");
24  break;
25  case Cause::Read:
26  format = _("Audacity failed to read from a file in %s.");
27  break;
28  case Cause::Write:
29  format =
30 _("Audacity failed to write to a file.\n"
31  "Perhaps %s is not writable or the disk is full.");
32  break;
33  case Cause::Rename:
34  format =
35 _("Audacity successfully wrote a file in %s but failed to rename it as %s.");
36  default:
37  break;
38  }
39  wxString target;
40 
41 #ifdef __WXMSW__
42 
43  // Drive letter plus colon
44  target = fileName.GetVolume() + wxT(":");
45 
46 #else
47 
48  // Shorten the path, arbitrarily to 3 components
49  auto path = fileName;
50  path.SetFullName(wxString{});
51  while(path.GetDirCount() > 3)
52  path.RemoveLastDir();
53  target = path.GetFullPath();
54 
55 #endif
56 
57  return wxString::Format(
58  format, target, renameTarget.GetFullName() );
59 }
60 
wxFileName renameTarget
Definition: FileException.h:46
int format
Definition: ExportPCM.cpp:56
wxFileName fileName
Definition: FileException.h:45
wxString ErrorMessage() const override
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
~FileException() override