From 7fe18235d9a87a1df10969c0a9495a2fde3b34b7 Mon Sep 17 00:00:00 2001 From: James Crook Date: Tue, 22 Sep 2020 13:59:59 +0100 Subject: [PATCH] Bug 2540 - No low disk space warning on startup --- src/Project.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Project.cpp b/src/Project.cpp index 807979d55..d0702f4b2 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -13,6 +13,8 @@ #include "Project.h" #include "KeyboardCapture.h" +#include "FileNames.h" +#include "widgets\ErrorDialog.h" #include #include @@ -122,6 +124,22 @@ AudacityProject::AudacityProject() AttachedObjects::BuildAll(); // But not for the attached windows. They get built only on demand, such as // from menu items. + + // Make sure there is plenty of space for Sqlite files + wxLongLong freeSpace = 0; + + auto path = FileNames::FindDefaultPath(FileNames::Operation::Temp); + if (wxGetDiskSpace(path, NULL, &freeSpace)) { + if (freeSpace < wxLongLong(wxLL(100 * 1048576))) { + ShowErrorDialog(nullptr, + XO("Warning"), + XO("There is very little free disk space left.\n" + "Please select a bigger temporary directory in Preferences."), + "Error:_Disk_full_or_not_writable" + ); + } + } + } AudacityProject::~AudacityProject()