From bf71461d789dbbd03ede59e8c42c57b30c6df339 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Fri, 1 Feb 2013 00:30:32 +0000 Subject: [PATCH] - see if this fixes loading issue on windows --- .../platform/common/platform_common.cpp | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 01d944c4..721cdb59 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -546,8 +546,36 @@ void trimPathWithStartingSlash(string &path) { } void updatePathClimbingParts(string &path) { + // Update paths with /./ + string::size_type pos = path.find("/./"); + if(pos != string::npos && pos != 0) { + string orig = path; + path.erase(pos,2); + pos--; + + pos = path.find("/./"); + if(pos != string::npos && pos != 0) { + updatePathClimbingParts(path); + } + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("CHANGED relative path from [%s] to [%s]\n",orig.c_str(),path.c_str()); + } + pos = path.find("\\.\\"); + if(pos != string::npos && pos != 0) { + string orig = path; + path.erase(pos,2); + pos--; + + pos = path.find("\\.\\"); + if(pos != string::npos && pos != 0) { + updatePathClimbingParts(path); + } + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("CHANGED relative path from [%s] to [%s]\n",orig.c_str(),path.c_str()); + } + // Update paths with .. - string::size_type pos = path.find(".."); + pos = path.find(".."); if(pos != string::npos && pos != 0) { string orig = path; path.erase(pos,2); @@ -572,21 +600,6 @@ void updatePathClimbingParts(string &path) { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("CHANGED relative path from [%s] to [%s]\n",orig.c_str(),path.c_str()); } - // Update paths with /./ - pos = path.find("/./"); - if(pos != string::npos && pos != 0) { - string orig = path; - path.erase(pos,2); - pos--; - - pos = path.find("/./"); - if(pos != string::npos && pos != 0) { - updatePathClimbingParts(path); - } - - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("CHANGED relative path from [%s] to [%s]\n",orig.c_str(),path.c_str()); - } - /* string::size_type pos = path.rfind(".."); if(pos != string::npos && pos != 0) {