summaryrefslogtreecommitdiff
path: root/cpp/src/IcePack/Activator.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-05-06 15:10:45 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-05-06 15:10:45 +0000
commit364a24f8e7674cf1d33629fc7a4c734d73d128fe (patch)
tree2d9a52f0be8e7164c92c13dce4f3ca2e17a46de7 /cpp/src/IcePack/Activator.cpp
parentModifed redme (diff)
downloadice-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/IcePack/Activator.cpp')
-rw-r--r--cpp/src/IcePack/Activator.cpp40
1 files changed, 22 insertions, 18 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
//