1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 07:39:42 +02:00

Bug 2610 - Backup Project only fails when it has actually run out of disk space (unlike Save Project)

This may not be a complete fix...needs more testing.
This commit is contained in:
Leland Lucius 2021-01-11 01:04:16 -06:00
parent c961d6236b
commit 60ebe7919a

View File

@ -292,6 +292,25 @@ bool ProjectFileManager::DoSave(const FilePath & fileName, const bool fromSaveAs
} }
} }
} }
wxULongLong fileSize = wxFileName::GetSize(projectFileIO.GetFileName());
wxDiskspaceSize_t freeSpace;
if (wxGetDiskSpace(FileNames::AbbreviatePath(fileName), NULL, &freeSpace))
{
if (freeSpace.GetValue() <= fileSize.GetValue())
{
ShowErrorDialog(
&window,
XO("Insufficient Disk Space"),
XO("The project size exceeds the available free space on the target disk.\n\n"
"Please select a different disk with more free space."),
"Error:_Disk_full_or_not_writable"
);
return false;
}
}
} }
// End of confirmations // End of confirmations
@ -614,9 +633,28 @@ bool ProjectFileManager::SaveCopy(const FilePath &fileName /* = wxT("") */)
continue; continue;
} }
wxULongLong fileSize = wxFileName::GetSize(projectFileIO.GetFileName());
wxDiskspaceSize_t freeSpace;
if (wxGetDiskSpace(FileNames::AbbreviatePath(filename.GetFullPath()), NULL, &freeSpace))
{
if (freeSpace.GetValue() <= fileSize.GetValue())
{
ShowErrorDialog(
&window,
XO("Insufficient Disk Space"),
XO("The project size exceeds the available free space on the target disk.\n\n"
"Please select a different disk with more free space."),
"Error:_Unsuitable_drive"
);
continue;
}
}
if (FileNames::IsOnFATFileSystem(filename.GetFullPath())) if (FileNames::IsOnFATFileSystem(filename.GetFullPath()))
{ {
if (wxFileName::GetSize(projectFileIO.GetFileName()) > UINT32_MAX) if (fileSize > UINT32_MAX)
{ {
ShowErrorDialog( ShowErrorDialog(
&window, &window,