summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-08-30 17:50:00 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-08-30 17:50:00 (GMT)
commit3e2e0d5d6384cd0eb84c6fb7bb3059497159446d (patch)
treee2aa29d419e6b0ead3d33fed0eeaa1b85699943c
parent4fb678e40dce4428374950d852b6070e8c720273 (diff)
downloadCMake-3e2e0d5d6384cd0eb84c6fb7bb3059497159446d.zip
CMake-3e2e0d5d6384cd0eb84c6fb7bb3059497159446d.tar.gz
CMake-3e2e0d5d6384cd0eb84c6fb7bb3059497159446d.tar.bz2
BUG: fixes for mingw and CMakesetup with spaces in the source directory
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp7
-rw-r--r--Source/cmSystemTools.h5
-rw-r--r--Source/kwsys/SystemTools.cxx9
3 files changed, 19 insertions, 2 deletions
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index ba6c28f..535573e 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -131,8 +131,13 @@ std::string ConvertToWindowsPath(const char* 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.
-
+ // save the value of the force to unix path option
+ bool saveForce = cmSystemTools::GetForceUnixPaths();
+ // make sure we get windows paths no matter what for the GUI
+ cmSystemTools::SetForceUnixPaths(false);
std::string s = cmSystemTools::ConvertToOutputPath(path);
+ // now restore the force unix path to its previous value
+ cmSystemTools::SetForceUnixPaths(saveForce);
if (s.size())
{
std::string::iterator i = s.begin();
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index e0fbffc..0cac0f0 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -253,6 +253,11 @@ public:
{
s_ForceUnixPaths = v;
}
+ static bool GetForceUnixPaths()
+ {
+ return s_ForceUnixPaths;
+ }
+
// ConvertToOutputPath use s_ForceUnixPaths
static std::string ConvertToOutputPath(const char* path);
// ConvertToRunCommandPath does not use s_ForceUnixPaths and should
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index f445c8e..f6826ac 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -708,7 +708,14 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
kwsys_stl::string::size_type pos = 0;
while((pos = path.find('\\', pos)) != kwsys_stl::string::npos)
{
- path[pos] = '/';
+ // make sure we don't convert an escaped space to a unix slash
+ if(pos < path.size()-2)
+ {
+ if(path[pos+1] != ' ')
+ {
+ path[pos] = '/';
+ }
+ }
pos++;
}
// Remove all // from the path just like most unix shells