diff --git a/src/DirManager.cpp b/src/DirManager.cpp index 9a249b567..fc781a823 100644 --- a/src/DirManager.cpp +++ b/src/DirManager.cpp @@ -381,8 +381,7 @@ void DirManager::CleanTempDir() RecursivelyRemove(filePathArray, count, true, true, _("Cleaning up temporary files")); } -bool DirManager::SetProject(wxString & projPath, wxString & projName, - bool create) +bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const bool bCreate) { wxString oldPath = this->projPath; wxString oldName = this->projName; @@ -391,17 +390,20 @@ bool DirManager::SetProject(wxString & projPath, wxString & projName, if (oldLoc == wxT("")) oldLoc = mytemp; - if (projPath == wxT("")) - projPath = ::wxGetCwd(); + if (newProjPath == wxT("")) + newProjPath = ::wxGetCwd(); - this->projPath = projPath; - this->projName = projName; - this->projFull = projPath + wxFILE_SEP_PATH + projName; + this->projPath = newProjPath; + this->projName = newProjName; + if (newProjPath.Last() == wxFILE_SEP_PATH) + this->projFull = newProjPath + newProjName; + else + this->projFull = newProjPath + wxFILE_SEP_PATH + newProjName; wxString cleanupLoc1=oldLoc; wxString cleanupLoc2=projFull; - if (create) { + if (bCreate) { if (!wxDirExists(projFull)) if (!wxMkdir(projFull)) return false; diff --git a/src/DirManager.h b/src/DirManager.h index 3feac1c29..a3cd3ab6c 100644 --- a/src/DirManager.h +++ b/src/DirManager.h @@ -49,7 +49,7 @@ class DirManager: public XMLTagHandler { // Returns true on success. // If SetProject is told NOT to create the directory // but it doesn't already exist, SetProject fails and returns false. - bool SetProject(wxString & projPath, wxString & projName, bool create); + bool SetProject(wxString& newProjPath, wxString& newProjName, const bool bCreate); wxString GetProjectDataDir(); wxString GetProjectName();