Improve the message for exhaustion of file storage on Windows

This commit is contained in:
Paul Licameli 2017-10-17 20:53:46 -04:00
parent 2d17ddc100
commit 68706c24c9
1 changed files with 18 additions and 9 deletions

View File

@ -50,15 +50,24 @@ _("Audacity successfully wrote a file in %s but failed to rename it as %s.");
default:
break;
}
wxString target = fileName.GetVolume();
if (target.empty()) {
// Shorten the path, arbitrarily to 3 components
auto path = fileName;
path.SetFullName(wxString{});
while(path.GetDirCount() > 3)
path.RemoveLastDir();
target = path.GetFullPath();
}
wxString target;
#ifdef __WXMSW__
// Drive letter plus colon
target = fileName.GetVolume() + wxT(":");
#else
// Shorten the path, arbitrarily to 3 components
auto path = fileName;
path.SetFullName(wxString{});
while(path.GetDirCount() > 3)
path.RemoveLastDir();
target = path.GetFullPath();
#endif
return wxString::Format(
format, target, renameTarget.GetFullName() );
}