diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-05-06 15:10:45 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-05-06 15:10:45 +0000 |
commit | 364a24f8e7674cf1d33629fc7a4c734d73d128fe (patch) | |
tree | 2d9a52f0be8e7164c92c13dce4f3ca2e17a46de7 /cpp/src | |
parent | Modifed redme (diff) | |
download | ice-364a24f8e7674cf1d33629fc7a4c734d73d128fe.tar.bz2 ice-364a24f8e7674cf1d33629fc7a4c734d73d128fe.tar.xz ice-364a24f8e7674cf1d33629fc7a4c734d73d128fe.zip |
Fixed bug where .bat couldn't be executed by IcePack
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IcePack/Activator.cpp | 40 | ||||
-rw-r--r-- | cpp/src/IcePack/Parser.cpp | 28 |
2 files changed, 46 insertions, 22 deletions
diff --git a/cpp/src/IcePack/Activator.cpp b/cpp/src/IcePack/Activator.cpp index 0c50e54627f..6467909ccd5 100644 --- a/cpp/src/IcePack/Activator.cpp +++ b/cpp/src/IcePack/Activator.cpp @@ -349,33 +349,37 @@ Activator::activate(const string& name, } string pwd = pwdPath; - #ifdef _WIN32 - // - // Get the absolute pathname of the executable. - // - char absbuf[_MAX_PATH]; - char* filePart; - if(SearchPath(NULL, path.c_str(), ".exe", _MAX_PATH, absbuf, &filePart) == 0) + if(path[0] != '.' && path[0] != '\\' && path[0] != '/' && !(path.size() > 1 && isalpha(path[0]) && path[1] == ':')) { - Error out(_traceLevels->logger); - out << "cannot convert `" << path << "' into an absolute path"; - return false; + // + // Get the absolute pathname of the executable. + // + char absbuf[_MAX_PATH]; + char* filePart; + string ext = path.size() <= 4 || path[path.size() - 4] != '.' ? ".exe" : ""; + if(SearchPath(NULL, path.c_str(), ext.c_str(), _MAX_PATH, absbuf, &filePart) == 0) + { + Error out(_traceLevels->logger); + out << "cannot convert `" << path << "' into an absolute path"; + return false; + } + path = absbuf; } - path = absbuf; // // Get the absolute pathname of the working directory. // if(!pwd.empty()) { - if(_fullpath(absbuf, pwd.c_str(), _MAX_PATH) == NULL) - { - Error out(_traceLevels->logger); - out << "cannot convert `" << pwd << "' into an absolute path"; - return false; - } - pwd = absbuf; + char absbuf[_MAX_PATH]; + if(_fullpath(absbuf, pwd.c_str(), _MAX_PATH) == NULL) + { + Error out(_traceLevels->logger); + out << "cannot convert `" << pwd << "' into an absolute path"; + return false; + } + pwd = absbuf; } #else // diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp index fd9b4b7baea..877afeb2c80 100644 --- a/cpp/src/IcePack/Parser.cpp +++ b/cpp/src/IcePack/Parser.cpp @@ -116,9 +116,19 @@ ServerDescribe::visitServerStart(const ServerWrapper&, const ServerDescriptorPtr if(!s->jvmOptions.empty()) { _out << nl << "jvmOptions = '"; - for(Ice::StringSeq::const_iterator p = s->jvmOptions.begin(); p != s->jvmOptions.end();) + Ice::StringSeq::const_iterator p = s->jvmOptions.begin(); + while(p != s->jvmOptions.end()) { - _out << *p << ((++p != s->jvmOptions.end()) ? " " : "'"); + _out << *p; + ++p; + if(p != s->jvmOptions.end()) + { + _out << " "; + } + else + { + _out << "'"; + } } } } @@ -142,9 +152,19 @@ ServerDescribe::visitServerStart(const ServerWrapper&, const ServerDescriptorPtr if(!server->options.empty()) { _out << nl << "options = '"; - for(Ice::StringSeq::const_iterator p = server->options.begin(); p != server->options.end();) + Ice::StringSeq::const_iterator p = server->options.begin(); + while(p != server->options.end()) { - _out << *p << ((++p != server->options.end()) ? " " : "'"); + _out << *p; + ++p; + if(p != server->options.end()) + { + _out << " "; + } + else + { + _out << "'"; + } } } if(!server->envs.empty()) |