summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-03-14 10:35:42 -0230
committerDwayne Boone <dwayne@zeroc.com>2008-03-14 10:35:42 -0230
commitc6d84b5f804ab65a7d16518cf13628a974957d52 (patch)
tree06ae5f7521314d2218c9a0ca4625fff5d0208b7b /cpp/src
parentfixing Mono makefiles wrt IceSSL (diff)
downloadice-c6d84b5f804ab65a7d16518cf13628a974957d52.tar.bz2
ice-c6d84b5f804ab65a7d16518cf13628a974957d52.tar.xz
ice-c6d84b5f804ab65a7d16518cf13628a974957d52.zip
Bug 2789
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp24
1 files changed, 24 insertions, 0 deletions
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 <Slice/Util.h>
#include <cstring>
+#ifndef _WIN32
+# include <fcntl.h>
+#endif
+
using namespace std;
using namespace Slice;
using namespace IceUtil;
@@ -52,6 +56,26 @@ Slice::changeInclude(const string& orig, const vector<string>& 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());