summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Util.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-06-06 12:46:58 -0230
committerBenoit Foucher <benoit@zeroc.com>2008-06-06 17:54:49 +0200
commita9169f12e8417b91a7dcfea3b678d09ed2697b62 (patch)
tree2e072cc1d8319a7ce213590e9e15c719f5b29ab9 /cpp/src/Slice/Util.cpp
parent- Fixed bug 3242 (diff)
downloadice-a9169f12e8417b91a7dcfea3b678d09ed2697b62.tar.bz2
ice-a9169f12e8417b91a7dcfea3b678d09ed2697b62.tar.xz
ice-a9169f12e8417b91a7dcfea3b678d09ed2697b62.zip
Bug 3014 - isAbsolute incorrect
Diffstat (limited to 'cpp/src/Slice/Util.cpp')
-rw-r--r--cpp/src/Slice/Util.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/cpp/src/Slice/Util.cpp b/cpp/src/Slice/Util.cpp
index a74c865ea7c..551aa0a4d46 100644
--- a/cpp/src/Slice/Util.cpp
+++ b/cpp/src/Slice/Util.cpp
@@ -9,6 +9,7 @@
#include <Slice/Util.h>
#include <IceUtil/Unicode.h>
+#include <IceUtil/FileUtil.h>
#include <climits>
#include <unistd.h> // For readlink()
@@ -64,25 +65,11 @@ normalizePath(const string& path)
return result;
}
-bool
-Slice::isAbsolute(const string& path)
-{
-#ifdef _WIN32
- if(path[0] == '\\' || path[0] == '/' || path.size() > 1 && isalpha(path[0]) && path[1] == ':')
-#else
- if(path[0] == '/')
-#endif
- {
- return true;
- }
- return false;
-}
-
string
Slice::fullPath(const string& path)
{
#ifdef _WIN32
- if(!isAbsolute(path))
+ if(!IceUtilInternal::isAbsolutePath(path))
{
wchar_t cwdbuf[_MAX_PATH];
if(_wgetcwd(cwdbuf, _MAX_PATH) != NULL)
@@ -93,7 +80,7 @@ Slice::fullPath(const string& path)
return normalizePath(path);
#else
string result = path;
- if(!isAbsolute(result))
+ if(!IceUtilInternal::isAbsolutePath(result))
{
char cwdbuf[PATH_MAX];
if(::getcwd(cwdbuf, PATH_MAX) != NULL)
@@ -125,7 +112,7 @@ Slice::fullPath(const string& path)
{
buf[len] = '\0';
string linkpath = buf;
- if(!isAbsolute(linkpath)) // Path relative to the location of the link
+ if(!IceUtilInternal::isAbsolutePath(linkpath)) // Path relative to the location of the link
{
string::size_type pos = subpath.rfind('/');
assert(pos != string::npos);