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/CPlusPlusUtil.cpp | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp') diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 8b495c53f0c..adaafa98b3a 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -8,6 +8,7 @@ // ********************************************************************** #include +#include using namespace std; using namespace Slice; @@ -29,28 +30,12 @@ Slice::ToIfdef::operator()(char c) } } -string -Slice::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, "/"); - } - if(result.size() > 1 && isalpha(result[0]) && result[1] == ':') - { - result = result.substr(2); - } - return result; -} - string Slice::changeInclude(const string& orig, const vector& includePaths) { - string file = normalizePath(orig); + string file = normalizePath(orig, true); string::size_type pos; + string cwd = getCwd(); // // Compare each include path against the included file and select @@ -59,7 +44,12 @@ Slice::changeInclude(const string& orig, const vector& includePaths) string result = file; for(vector::const_iterator p = includePaths.begin(); p != includePaths.end(); ++p) { - string includePath = normalizePath(*p); + string includePath = *p; + if(isAbsolute(orig) && !isAbsolute(includePath)) + { + includePath = cwd + "/" + includePath; + } + includePath = normalizePath(includePath, true); if(file.compare(0, includePath.length(), includePath) == 0) { -- cgit v1.2.3