mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Don't open a file just to query its length
This commit is contained in:
@@ -2261,7 +2261,9 @@ wxLongLong ProjectFileIO::GetFreeDiskSpace() const
|
||||
if (IsOnFATFileSystem(mFileName)) {
|
||||
// 4 GiB per-file maximum
|
||||
constexpr auto limit = 1ll << 32;
|
||||
auto length = wxFile{mFileName}.Length();
|
||||
auto length = wxFileName::GetSize(mFileName);
|
||||
if (length == wxInvalidSize)
|
||||
length = 0;
|
||||
auto free = std::max<wxLongLong>(0, limit - length);
|
||||
freeSpace = std::min(freeSpace, free);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user