From f24e7084d5ebce8689e02d5f322d175d4108cf00 Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Wed, 9 Jan 2008 10:46:08 -0330 Subject: Use mcpp instead of icecpp --- cpp/src/Slice/PythonUtil.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'cpp/src/Slice/PythonUtil.cpp') diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 1dad0ec46b6..515e42a9f75 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -1760,24 +1761,12 @@ Slice::Python::CodeVisitor::collectExceptionMembers(const ExceptionPtr& p, Membe } } -static string -normalizePath(const string& path) -{ - string result = path; - replace(result.begin(), result.end(), '\\', '/'); - string::size_type pos; - while((pos = result.find("//")) != string::npos) - { - result.replace(pos, 2, "/"); - } - return result; -} - static string changeInclude(const string& inc, const vector& includePaths) { string orig = normalizePath(inc); string curr = orig; // The current shortest pathname. + string cwd = getCwd(); // // Compare the pathname of the included file against each of the include directories. @@ -1787,10 +1776,15 @@ changeInclude(const string& inc, const vector& includePaths) for(vector::const_iterator p = includePaths.begin(); p != includePaths.end(); ++p) { string includePath = *p; + if(isAbsolute(orig) && !isAbsolute(includePath)) + { + includePath = cwd + "/" + includePath; + } + includePath = normalizePath(includePath); - if(orig.compare(0, p->size(), *p) == 0) + if(orig.compare(0, includePath.size(), includePath) == 0) { - string s = orig.substr(p->size()); + string s = orig.substr(includePath.size()); if(s.size() < curr.size()) { curr = s; -- cgit v1.2.3