Linux: Fix printing error when checking freespace during volume creation

No parent directory specified in the path, we assume current directory
We first check if parent directory exists before checking its free space
using wxgetDiskSpace

Based on idea proposed by @bogdro in PR#1025
This commit is contained in:
Mounir IDRASSI 2023-05-22 01:05:17 +02:00
parent eb61010ce2
commit b872702309
No known key found for this signature in database
GPG Key ID: 02C30AE90FAE4A6F

View File

@ -652,7 +652,12 @@ namespace VeraCrypt
{
uint64 AvailableDiskSpace = 0;
wxLongLong diskSpace = 0;
if (wxGetDiskSpace (wxFileName (wstring (options->Path)).GetPath(), nullptr, &diskSpace))
wxString parentDir = wxFileName (wstring (options->Path)).GetPath();
if (parentDir.IsEmpty())
{
parentDir = wxT(".");
}
if (wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace))
{
AvailableDiskSpace = (uint64) diskSpace.GetValue ();
if (maxVolumeSize > AvailableDiskSpace)