summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Preprocessor.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-04-21 17:58:38 +0200
committerBenoit Foucher <benoit@zeroc.com>2008-04-21 17:58:38 +0200
commit094286e06f0ff154f20fcccce0c71068a3d216d5 (patch)
tree606797928608baa057fe9a9ea096622e0eb37930 /cpp/src/Slice/Preprocessor.cpp
parentFixed potential IceUtil::NullHandleException (diff)
downloadice-094286e06f0ff154f20fcccce0c71068a3d216d5.tar.bz2
ice-094286e06f0ff154f20fcccce0c71068a3d216d5.tar.xz
ice-094286e06f0ff154f20fcccce0c71068a3d216d5.zip
Fixed bug 3011
Diffstat (limited to 'cpp/src/Slice/Preprocessor.cpp')
-rwxr-xr-xcpp/src/Slice/Preprocessor.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp
index b5efe23096e..d5231c06fbe 100755
--- a/cpp/src/Slice/Preprocessor.cpp
+++ b/cpp/src/Slice/Preprocessor.cpp
@@ -255,6 +255,13 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin
pos = unprocessed.find(suffix) + suffix.size();
string result = unprocessed.substr(0, pos);
+ vector<string> fullIncludePaths;
+ vector<string>::const_iterator p;
+ for(p = includePaths.begin(); p != includePaths.end(); ++p)
+ {
+ fullIncludePaths.push_back(fullPath(*p));
+ }
+
//
// Process each dependency.
//
@@ -264,25 +271,18 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin
end += 4;
string file = IceUtilInternal::trim(unprocessed.substr(pos, end - pos));
- //
- // Normalize paths if not relative path.
- //
if(isAbsolute(file))
{
+ //
+ // Transform back full paths generated by mcpp to paths relative to the specificed
+ // include paths.
+ //
string newFile = file;
- string cwd = getCwd();
- for(vector<string>::const_iterator p = includePaths.begin(); p != includePaths.end(); ++p)
+ for(vector<string>::const_iterator p = fullIncludePaths.begin(); p != fullIncludePaths.end(); ++p)
{
- string includePath = *p;
- if(!isAbsolute(includePath))
- {
- includePath = cwd + "/" + includePath;
- }
- includePath = normalizePath(includePath, false);
-
- if(file.compare(0, includePath.length(), includePath) == 0)
+ if(file.compare(0, p->length(), *p) == 0)
{
- string s = *p + file.substr(includePath.length());
+ string s = includePaths[p - fullIncludePaths.begin()] + file.substr(p->length());
if(isAbsolute(newFile) || s.size() < newFile.size())
{
newFile = s;