1
0
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:
Paul Licameli
2020-11-24 14:15:36 -05:00
parent 8e28a257a5
commit 0d5b9753bc

View File

@@ -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);
}