From c6d84b5f804ab65a7d16518cf13628a974957d52 Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Fri, 14 Mar 2008 10:35:42 -0230 Subject: Bug 2789 --- cpp/src/Slice/CPlusPlusUtil.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp') diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index a7b24bda2cf..47a292158c5 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -11,6 +11,10 @@ #include #include +#ifndef _WIN32 +# include +#endif + using namespace std; using namespace Slice; using namespace IceUtil; @@ -52,6 +56,26 @@ Slice::changeInclude(const string& orig, const vector& includePaths) } includePath = normalizePath(includePath, true); +#ifndef _WIN32 + // + // We need to get the real path name of the include directory in case + // it is a symlink, since the preprocessor output contains real path names. + // + if(isAbsolute(includePath)) + { + int fd = open(".", O_RDONLY); + if(fd != -1) + { + if (!chdir(includePath.c_str())) + { + includePath = getCwd() + "/"; + fchdir(fd); + } + close(fd); + } + } +#endif + if(file.compare(0, includePath.length(), includePath) == 0) { string s = file.substr(includePath.length()); -- cgit v1.2.3