diff --git a/src/DirManager.cpp b/src/DirManager.cpp index 759e84916..c39e4b83c 100644 --- a/src/DirManager.cpp +++ b/src/DirManager.cpp @@ -537,14 +537,21 @@ wxString DirManager::GetProjectName() wxLongLong DirManager::GetFreeDiskSpace() { wxLongLong freeSpace = -1; - wxString path = projPath; + wxFileName path; - if (projPath == wxT("")) - path = mytemp; + path.SetPath(projPath.IsEmpty() ? mytemp : projPath); + + // Use the parent directory if the project directory hasn't yet been created + if (!path.DirExists()) { - if (!wxGetDiskSpace(path, NULL, &freeSpace)) - freeSpace = -1; + path.RemoveLastDir(); } + + if (!wxGetDiskSpace(path.GetFullPath(), NULL, &freeSpace)) + { + freeSpace = -1; + } + return freeSpace; } diff --git a/src/Project.cpp b/src/Project.cpp index f916671ce..0549f54d5 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -4212,7 +4212,7 @@ void AudacityProject::OnTimer(wxTimerEvent& WXUNUSED(event)) // gAudioIO->GetNumCaptureChannels() should only be positive // when we are recording. - if (gAudioIO->GetNumCaptureChannels() > 0) { + if (GetAudioIOToken() > 0 && gAudioIO->GetNumCaptureChannels() > 0) { wxLongLong freeSpace = mDirManager->GetFreeDiskSpace(); if (freeSpace >= 0) { wxString msg;