summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-04-19 15:49:12 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-04-19 15:49:12 (GMT)
commit89a697a3b9e9a4ec6f54f3b24130fc86cd9d29f7 (patch)
tree69050485df11f5f4d1c72048ec82f06e63629724 /Source
parent719a334f8470671810fde4f817dbfe181e0cf4b6 (diff)
downloadCMake-89a697a3b9e9a4ec6f54f3b24130fc86cd9d29f7.zip
CMake-89a697a3b9e9a4ec6f54f3b24130fc86cd9d29f7.tar.gz
CMake-89a697a3b9e9a4ec6f54f3b24130fc86cd9d29f7.tar.bz2
BUG: fix short path on files that do not exist
Diffstat (limited to 'Source')
-rw-r--r--Source/cmNMakeMakefileGenerator.cxx19
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx
index 27ef084..f70f7c6 100644
--- a/Source/cmNMakeMakefileGenerator.cxx
+++ b/Source/cmNMakeMakefileGenerator.cxx
@@ -81,13 +81,24 @@ std::string cmNMakeMakefileGenerator::ShortPathCommand(const char* command)
if(reg.find(command))
{
std::string c = reg.match(1);
- cmRegularExpression removeIntDir("(.*)/\\$\\(IntDir\\)(.*)");
+ cmRegularExpression removeIntDir("(.*)(/|\\\\)\\$\\(IntDir\\)(.*)");
if(removeIntDir.find(c))
{
- c = removeIntDir.match(1) + removeIntDir.match(2);
+ c = removeIntDir.match(1) + removeIntDir.match(3);
}
- c = this->ShortPath(c.c_str());
- std::string ret = c;
+ std::string unix = c;
+ // since the command may already be a windows path, convert it
+ // to unix so we can use SplitProgramPath on it.
+ cmSystemTools::ConvertToUnixSlashes(unix);
+ std::string path, file;
+ cmSystemTools::SplitProgramPath(unix.c_str(), path, file);
+ // do a short path on the directory, because ShortPath will
+ // not work for files that do not exist
+ path = this->ShortPath(path.c_str());
+ // now put the two back together
+ path += "\\";
+ path += file;
+ std::string ret = path;
std::string args = reg.match(2);
ret += args;
return ret;