summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Util.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2009-12-04 14:49:01 -0330
committerDwayne Boone <dwayne@zeroc.com>2009-12-04 14:49:01 -0330
commitb65ce18e809363b762b2feb615552b059bc41089 (patch)
tree819473b0ebc16e0523c118cafdb54a25a3f1bb39 /cpp/src/Slice/Util.cpp
parentFixed windows compile errors (diff)
downloadice-b65ce18e809363b762b2feb615552b059bc41089.tar.bz2
ice-b65ce18e809363b762b2feb615552b059bc41089.tar.xz
ice-b65ce18e809363b762b2feb615552b059bc41089.zip
Bug 4366 - slice2cpp and symbolic link slice files
Diffstat (limited to 'cpp/src/Slice/Util.cpp')
-rw-r--r--cpp/src/Slice/Util.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/cpp/src/Slice/Util.cpp b/cpp/src/Slice/Util.cpp
index e2c4049c2c7..610bc348b50 100644
--- a/cpp/src/Slice/Util.cpp
+++ b/cpp/src/Slice/Util.cpp
@@ -117,7 +117,7 @@ Slice::fullPath(const string& path)
{
subpath = result.substr(0, next);
}
-
+
char buf[PATH_MAX + 1];
int len = readlink(subpath.c_str(), buf, sizeof(buf));
if(len > 0)
@@ -147,7 +147,17 @@ Slice::fullPath(const string& path)
string
Slice::changeInclude(const string& orig, const vector<string>& includePaths)
{
- string file = fullPath(orig);
+ //
+ // MCPP does not follow symlinks included files so we only
+ // call fullPath on the base directory and not the file itself.
+ //
+ string file = orig;
+ string::size_type pos;
+ if((pos = orig.rfind('/')) != string::npos)
+ {
+ string base = orig.substr(0, pos);
+ file = fullPath(base) + orig.substr(pos);
+ }
//
// Compare each include path against the included file and select
@@ -175,7 +185,6 @@ Slice::changeInclude(const string& orig, const vector<string>& includePaths)
result = normalizePath(orig);
}
- string::size_type pos;
if((pos = result.rfind('.')) != string::npos)
{
result.erase(pos);