From 6c6cef66bbb974e3a3c847a1b643326311059578 Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Fri, 21 Mar 2008 16:11:34 -0230 Subject: Bug 2885 --- cpp/src/Slice/CPlusPlusUtil.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp') diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 1587897fd63..782bbe72a68 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -48,19 +48,20 @@ Slice::changeInclude(const string& orig, const vector& includePaths) file = normalizePath(file, true); // - // Compare each include path against the included file and select - // the path that produces the shortest relative filename. + // Modify the list of include paths to be absolute paths, with and + // without symlinks resolved. // - string result = file; + vector newIncludePaths; for(vector::const_iterator p = includePaths.begin(); p != includePaths.end(); ++p) { string includePath = *p; -#ifdef _WIN32 if(!isAbsolute(includePath)) { includePath = cwd + "/" + includePath; } -#else + newIncludePaths.push_back(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. @@ -75,9 +76,18 @@ Slice::changeInclude(const string& orig, const vector& includePaths) } close(fd); } + newIncludePaths.push_back(normalizePath(includePath, true)); #endif - includePath = normalizePath(includePath, true); + } + // + // Compare each include path against the included file and select + // the path that produces the shortest relative filename. + // + string result = file; + for(vector::const_iterator p = newIncludePaths.begin(); p != newIncludePaths.end(); ++p) + { + string includePath = *p; if(file.compare(0, includePath.length(), includePath) == 0) { string s = file.substr(includePath.length()); -- cgit v1.2.3