DirManager::DirManager() { wxLogDebug("DirManager: Created new instance"); mRef = 1; // MM: Initial refcount is 1 by convention numDirManagers++; if (numDirManagers == 1) { CleanTempDir(); } projPath = ""; projName = ""; mLoadingTarget = NULL; hashTableSize = defaultHashTableSize; blockFileHash = new wxHashTable(wxKEY_STRING, hashTableSize); // Make sure there is plenty of space for temp files //BG: wxWindows 2.3.2 and higher claim to support this, through a function called wxGetDiskSpace wxLongLong freeSpace; wxGetDiskSpace(temp, NULL, &freeSpace); if (freeSpace >= 0) { if (freeSpace < 1048576) { // TODO: allow user to select different temporary volume. wxMessageBox( _("Warning: there is very little free disk space left on this " "volume. Please select another temporary directory in your " "preferences.")); } } }
void R_CleanUp(SA_TYPE saveact, int status, int runLast) { if(saveact == SA_DEFAULT) /* The normal case apart from R_Suicide */ saveact = SaveAction; if(saveact == SA_SAVEASK) { if(R_Interactive) { switch (R_YesNoCancel(G_("Save workspace image?"))) { case YES: saveact = SA_SAVE; break; case NO: saveact = SA_NOSAVE; break; case CANCEL: jump_to_toplevel(); break; } } else saveact = SaveAction; } switch (saveact) { case SA_SAVE: if(runLast) R_dot_Last(); if(R_DirtyImage) R_SaveGlobalEnv(); if (CharacterMode == RGui || (R_Interactive && CharacterMode == RTerm)) { R_setupHistory(); /* re-read the history size and filename */ gl_savehistory(R_HistoryFile, R_HistorySize); } break; case SA_NOSAVE: if(runLast) R_dot_Last(); break; case SA_SUICIDE: default: break; } R_RunExitFinalizers(); editorcleanall(); CleanEd(); CleanTempDir(); closeAllHlpFiles(); KillAllDevices(); AllDevicesKilled = TRUE; if (R_Interactive && CharacterMode == RTerm) SetConsoleTitle(oldtitle); UnLoad_Rbitmap_Dll(); if (R_CollectWarnings && saveact != SA_SUICIDE && CharacterMode == RTerm) PrintWarnings(); app_cleanup(); RConsole = NULL; exit(status); }
DirManager::~DirManager() { if (blockFileHash) delete blockFileHash; numDirManagers--; if (numDirManagers==0) { CleanTempDir(); } }
DirManager::~DirManager() { wxASSERT(mRef == 0); // MM: Otherwise, we shouldn't delete it numDirManagers--; if (numDirManagers == 0) { CleanTempDir(); //::wxRmdir(temp); } }
DirManager::~DirManager() { wxASSERT(mRef == 0); // MM: Otherwise, we shouldn't delete it if (blockFileHash) delete blockFileHash; numDirManagers--; if (numDirManagers == 0) { CleanTempDir(false); //::wxRmdir(temp); } }
DirManager::DirManager() { if (firstCtor) { if (!wxPathExists(temp)) wxMkdir(temp); firstCtor = false; } numDirManagers++; if (numDirManagers==1) { CleanTempDir(); } projPath = ""; projName = ""; blockFileHash = new wxHashTable(wxKEY_STRING, defaultHashTableSize); }
DirManager::DirManager() { if (firstCtor) { // The first time a DirManager is created, we need to find // a temp directory location. firstCtor = false; wxString tempFromPrefs = gPrefs->Read("/Directories/TempDir", ""); wxString tempDefaultLoc = temp; temp = ""; #ifdef __WXGTK__ if (tempFromPrefs.GetChar(0) != '/') tempFromPrefs = ""; #endif // Stop wxWindows from printing its own error messages wxLogNull logNo; // Try temp dir that was stored in prefs first if (tempFromPrefs != "") { if (wxPathExists(tempFromPrefs)) temp = tempFromPrefs; else if (wxMkdir(tempFromPrefs)) temp = tempFromPrefs; } // If that didn't work, try the default location if (temp=="" && tempDefaultLoc != "") { if (wxPathExists(tempDefaultLoc)) temp = tempDefaultLoc; else if (wxMkdir(tempDefaultLoc)) temp = tempDefaultLoc; } if (temp != "") { // Success gPrefs->Write("/Directories/TempDir", temp); } else { wxMessageBox("Audacity could not find a place to store temporary files.\n" "Please enter an appropriate directory in the " "preferences dialog."); PrefsDialog dialog(NULL); dialog.ShowModal(); wxMessageBox("Audacity is now going to exit. Please launch Audacity " "again to use the new temporary directory."); wxExit(); } } numDirManagers++; if (numDirManagers == 1) { CleanTempDir(); } projPath = ""; projName = ""; hashTableSize = defaultHashTableSize; blockFileHash = new wxHashTable(wxKEY_STRING, hashTableSize); // Make sure there is plenty of space for temp files wxLongLong freeSpace = GetFreeDiskSpace((char *) (const char *) temp); if (freeSpace >= 0) { if (freeSpace < 1048576) { // TODO: allow user to select different temporary volume. wxMessageBox ("Warning: there is very little free disk space left on this volume. Please select another temporary directory in your preferences."); } } }