summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Util.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2014-11-06 00:08:39 +0100
committerJose <jose@zeroc.com>2014-11-06 00:08:39 +0100
commit0aea68b0791ca5d1e7f4928896276e6f5fa812f5 (patch)
tree9aebf0a444881995631dd1f6b9fe9dce3e0ff186 /cpp/src/Slice/Util.cpp
parentmakedist fix (diff)
downloadice-0aea68b0791ca5d1e7f4928896276e6f5fa812f5.tar.bz2
ice-0aea68b0791ca5d1e7f4928896276e6f5fa812f5.tar.xz
ice-0aea68b0791ca5d1e7f4928896276e6f5fa812f5.zip
Fixed (ICE-5833) - slice2cpp includes & symbolic links
Diffstat (limited to 'cpp/src/Slice/Util.cpp')
-rw-r--r--cpp/src/Slice/Util.cpp58
1 files changed, 2 insertions, 56 deletions
diff --git a/cpp/src/Slice/Util.cpp b/cpp/src/Slice/Util.cpp
index d7362c18692..4d10465349e 100644
--- a/cpp/src/Slice/Util.cpp
+++ b/cpp/src/Slice/Util.cpp
@@ -10,20 +10,12 @@
#include <Slice/Util.h>
#include <IceUtil/FileUtil.h>
#include <IceUtil/StringUtil.h>
-#include <climits>
-
-#ifndef _MSC_VER
-# include <unistd.h> // For readlink()
-#endif
using namespace std;
using namespace Slice;
-namespace
-{
-
string
-normalizePath(const string& path)
+Slice::normalizePath(const string& path)
{
string result = path;
@@ -79,8 +71,6 @@ normalizePath(const string& path)
return result;
}
-}
-
string
Slice::fullPath(const string& path)
{
@@ -94,51 +84,7 @@ Slice::fullPath(const string& path)
}
}
- result = normalizePath(result);
-
-#ifdef _WIN32
- return result;
-#else
-
- string::size_type beg = 0;
- string::size_type next;
- do
- {
- string subpath;
- next = result.find('/', beg + 1);
- if(next == string::npos)
- {
- subpath = result;
- }
- else
- {
- subpath = result.substr(0, next);
- }
-
- char buf[PATH_MAX + 1];
- int len = static_cast<int>(readlink(subpath.c_str(), buf, sizeof(buf)));
- if(len > 0)
- {
- buf[len] = '\0';
- string linkpath = buf;
- if(!IceUtilInternal::isAbsolutePath(linkpath)) // Path relative to the location of the link
- {
- string::size_type pos = subpath.rfind('/');
- assert(pos != string::npos);
- linkpath = subpath.substr(0, pos + 1) + linkpath;
- }
- result = normalizePath(linkpath) + (next != string::npos ? result.substr(next) : string());
- beg = 0;
- next = 0;
- }
- else
- {
- beg = next;
- }
- }
- while(next != string::npos);
- return result;
-#endif
+ return normalizePath(result);
}
string