summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2007-02-22 20:33:49 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2007-02-22 20:33:49 (GMT)
commit417b2073dfa571c4b4ae9f17d9ddfce0e32a67c9 (patch)
tree93c6c5bc76c65fbb7f5c92ae6590e7e5668ec163 /Source
parent2a64bb477462a03da3ba917364d9e66921665bc9 (diff)
downloadCMake-417b2073dfa571c4b4ae9f17d9ddfce0e32a67c9.zip
CMake-417b2073dfa571c4b4ae9f17d9ddfce0e32a67c9.tar.gz
CMake-417b2073dfa571c4b4ae9f17d9ddfce0e32a67c9.tar.bz2
ENH: add new escape stuff
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalGenerator.cxx45
1 files changed, 14 insertions, 31 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index cacce68..bcbbcee 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1014,20 +1014,16 @@ cmLocalGenerator::ExpandRuleVariables(std::string& s,
std::string
cmLocalGenerator::ConvertToOutputForExisting(const char* p)
{
- std::string ret = this->Convert(p, START_OUTPUT, SHELL, true);
- // if there are spaces in the path, then get the short path version
- // if there is one
- if(ret.find(' ') != std::string::npos)
+ std::string ret = p;
+ if(this->WindowsShell && ret.find(' ') != ret.npos
+ && cmSystemTools::FileExists(p))
{
- if(cmSystemTools::FileExists(p))
+ if(cmSystemTools::GetShortPath(p, ret))
{
- if(!cmSystemTools::GetShortPath(ret.c_str(), ret))
- {
- ret = this->Convert(p,START_OUTPUT,SHELL,true);
- }
+ return this->Convert(ret.c_str(), NONE, SHELL, true);
}
}
- return ret;
+ return this->Convert(p, START_OUTPUT, SHELL, true);
}
const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
@@ -2062,21 +2058,6 @@ std::string cmLocalGenerator::Convert(const char* source,
}
if( output == SHELL)
{
- // for shell commands if force unix is on, but this->WindowsShell
- // is true, then turn off force unix paths for the output path
- // so that the path is windows style and will work with windows
- // cmd.exe.
- bool forceOn = cmSystemTools::GetForceUnixPaths();
- if(forceOn && this->WindowsShell)
- {
- cmSystemTools::SetForceUnixPaths(false);
- }
- result = cmSystemTools::ConvertToOutputPath(result.c_str());
- if(forceOn && this->WindowsShell)
- {
- cmSystemTools::SetForceUnixPaths(true);
- }
-
// For the MSYS shell convert drive letters to posix paths, so
// that c:/some/path becomes /c/some/path. This is needed to
// avoid problems with the shell path translation.
@@ -2088,14 +2069,16 @@ std::string cmLocalGenerator::Convert(const char* source,
result[0] = '/';
}
}
- // if this is unix then we need to escape () in the shell
-#if !defined(WIN32) || defined(CYGWIN)
- forceOn = true;
-#endif
- if(forceOn )
+ if(this->WindowsShell)
{
- result = cmSystemTools::EscapeForUnixShell(result);
+ std::string::size_type pos = 0;
+ while((pos = result.find('/', pos)) != std::string::npos)
+ {
+ result[pos] = '\\';
+ pos++;
+ }
}
+ result = this->EscapeForShell(result.c_str(), true, false);
}
return result;
}