1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-24 16:20:05 +02:00

Fix disk space checking to prevent error message

The error message only happens in debug builds, but the cause of
the message still happens in release builds.  Basically, the temporary
project directory may not yet be created if the person is only monitoring.
This commit is contained in:
lllucius 2015-01-06 16:16:01 +00:00
parent 5e46430d80
commit f60afbb8da
2 changed files with 13 additions and 6 deletions

View File

@ -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())
{
path.RemoveLastDir();
}
if (!wxGetDiskSpace(path.GetFullPath(), NULL, &freeSpace))
{
if (!wxGetDiskSpace(path, NULL, &freeSpace))
freeSpace = -1;
}
return freeSpace;
}

View File

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