summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/PythonUtil.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-01-09 10:46:08 -0330
committerDwayne Boone <dwayne@zeroc.com>2008-01-09 10:46:08 -0330
commitf24e7084d5ebce8689e02d5f322d175d4108cf00 (patch)
treec484017689764bed48fa846be070d168ff469d64 /cpp/src/Slice/PythonUtil.cpp
parentFinished fixes for bug 2132 (diff)
downloadice-f24e7084d5ebce8689e02d5f322d175d4108cf00.tar.bz2
ice-f24e7084d5ebce8689e02d5f322d175d4108cf00.tar.xz
ice-f24e7084d5ebce8689e02d5f322d175d4108cf00.zip
Use mcpp instead of icecpp
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r--cpp/src/Slice/PythonUtil.cpp24
1 files changed, 9 insertions, 15 deletions
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 <Slice/PythonUtil.h>
#include <Slice/Checksum.h>
+#include <Slice/Util.h>
#include <IceUtil/IceUtil.h>
#include <IceUtil/StringUtil.h>
#include <IceUtil/InputUtil.h>
@@ -1761,23 +1762,11 @@ 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<string>& 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<string>& includePaths)
for(vector<string>::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;