summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-02-16 18:15:25 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2005-02-16 18:15:25 (GMT)
commitee0db4aeb468056b978ff5282463e393b27c55e0 (patch)
tree73b5293ea00c8ee028579fe3b0efc649138b4905 /Source
parente689bfa20102a1287a698c081b7c2670adfda120 (diff)
downloadCMake-ee0db4aeb468056b978ff5282463e393b27c55e0.zip
CMake-ee0db4aeb468056b978ff5282463e393b27c55e0.tar.gz
CMake-ee0db4aeb468056b978ff5282463e393b27c55e0.tar.bz2
BUG: fix CommandLine test problems with spaces and testing for the return value
Diffstat (limited to 'Source')
-rw-r--r--Source/cmake.cxx18
-rw-r--r--Source/cmakemain.cxx4
2 files changed, 18 insertions, 4 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,
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 932aab9..829d907 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -184,7 +184,9 @@ int do_cmake(int ac, char** av)
{
wiz = true;
}
- else if (strcmp(av[i], "-E") == 0)
+ // if command has already been set, then
+ // do not eat the -E
+ else if (!command && strcmp(av[i], "-E") == 0)
{
command = true;
}