diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2002-07-31 14:34:06 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2002-07-31 14:34:06 (GMT) |
commit | b5cf03b5e742dee22f9d7977148b85e73a074b02 (patch) | |
tree | 8f89bde4890346f8a4d977fcb1ccfca98da60d5c /Source/MFCDialog | |
parent | 843616ec7e4653e9cb783ffdbbb5cc3d9c5f586f (diff) | |
download | CMake-b5cf03b5e742dee22f9d7977148b85e73a074b02.zip CMake-b5cf03b5e742dee22f9d7977148b85e73a074b02.tar.gz CMake-b5cf03b5e742dee22f9d7977148b85e73a074b02.tar.bz2 |
FIX: ConvertToOutputPath puts "" around path. Not compatible with GUI use.
Diffstat (limited to 'Source/MFCDialog')
-rw-r--r-- | Source/MFCDialog/CMakeSetupDialog.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index 73d9a8c..40d7016 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -19,6 +19,31 @@ static char THIS_FILE[] = __FILE__; #endif +// Convert to Win32 path (slashes). But it's not in cmSystemTools, so +// the 2 billions people that are using the CMake API can not mistake +// it with cmMakeMyCoffeeButNoSugarPlease(). + +std::string ConvertToWindowsPath(const char* path) +{ + // Convert to output path. + // Remove the "" around it (if any) since it's an output path for + // the shell. If another shell-oriented feature is not designed + // for a GUI use, then we are in trouble. + + std::string s = cmSystemTools::ConvertToOutputPath(path); + std::string::iterator i = s.begin(); + if (*i == '\"') + { + s.erase(i, i + 1); + } + i = s.begin() + s.length() - 1; + if (*i == '\"') + { + s.erase(i, i + 1); + } + return s; +} + ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About @@ -622,7 +647,7 @@ void CMakeSetupDialog::OnChangeWhereBuild() cache->LoadCache(path.c_str()) && cache->GetCacheEntry("CMAKE_HOME_DIRECTORY")) { - path = cmSystemTools::ConvertToOutputPath( + path = ConvertToWindowsPath( cache->GetCacheEntry("CMAKE_HOME_DIRECTORY")->m_Value.c_str()); this->m_WhereSource = path.c_str(); this->m_WhereSourceControl.SetWindowText(this->m_WhereSource); @@ -1219,16 +1244,16 @@ void CMakeSetupDialog::ChangeDirectoriesFromFile(const char* buffer) cache->LoadCache(path.c_str()) && cache->GetCacheEntry("CMAKE_HOME_DIRECTORY")) { - path = cmSystemTools::ConvertToOutputPath(path.c_str()); + path = ConvertToWindowsPath(path.c_str()); this->m_WhereBuild = path.c_str(); - path = cmSystemTools::ConvertToOutputPath( + path = ConvertToWindowsPath( cache->GetCacheEntry("CMAKE_HOME_DIRECTORY")->m_Value.c_str()); this->m_WhereSource = path.c_str(); } else { - path = cmSystemTools::ConvertToOutputPath(path.c_str()); + path = ConvertToWindowsPath(path.c_str()); this->m_WhereSource = this->m_WhereBuild = path.c_str(); } } |