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
1 changed files with 39 additions and 1 deletions

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
@ -614,9 +633,28 @@ bool ProjectFileManager::SaveCopy(const FilePath &fileName /* = wxT("") */)
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 (wxFileName::GetSize(projectFileIO.GetFileName()) > UINT32_MAX)
if (fileSize > UINT32_MAX)
{
ShowErrorDialog(
&window,