summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3a8e26e..0e0cce8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -778,16 +778,28 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
else if (args[1] == "chdir" && args.size() >= 4)
{
std::string directory = args[2];
+ unsigned pos = 3;
+ if(!cmSystemTools::FileExists(directory.c_str()))
+ {
+ directory += " ";
+ directory += args[3];
+ if(!cmSystemTools::FileExists(directory.c_str()))
+ {
+ cmSystemTools::Error("Directory does not exist for chdir command (try1): ", args[2].c_str());
+ cmSystemTools::Error("Directory does not exist for chdir command (try2): ", directory.c_str());
+ }
+ pos = 4;
+ }
+
std::string command = "\"";
- command += args[3];
+ command += args[pos];
command += "\"";
- for (std::string::size_type cc = 4; cc < args.size(); cc ++)
+ for (std::string::size_type cc = pos+1; cc < args.size(); cc ++)
{
command += " \"";
command += args[cc];
command += "\"";
}
-
int retval = 0;
int timeout = 0;
if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,