summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBob Jamison <ishmalius@gmail.com>2006-04-22 22:45:39 +0000
committerishmal <ishmal@users.sourceforge.net>2006-04-22 22:45:39 +0000
commitfdadbb3b13631cc9a4244f378a102dd64bae662b (patch)
treedd7585edf0d635c3d46ea0710e5a4fd7cb740cd2 /src
parentAdd test for norlalization and resolution (diff)
downloadinkscape-fdadbb3b13631cc9a4244f378a102dd64bae662b.tar.gz
inkscape-fdadbb3b13631cc9a4244f378a102dd64bae662b.zip
Native path support
(bzr r571)
Diffstat (limited to 'src')
-rw-r--r--src/dom/uri.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/dom/uri.cpp b/src/dom/uri.cpp
index e65c5edff..167b1f084 100644
--- a/src/dom/uri.cpp
+++ b/src/dom/uri.cpp
@@ -236,6 +236,32 @@ DOMString URI::getPath() const
return path;
}
+DOMString URI::getNativePath() const
+{
+ DOMString npath;
+#ifdef __WIN32__
+ unsigned int firstChar = 0;
+ if (path.size() >= 3)
+ {
+ if (path[0] == '/' &&
+ isLetter(path[1]) &&
+ path[2] == ':')
+ firstChar++;
+ }
+ for (unsigned int i=firstChar ; i<path.size() ; i++)
+ {
+ XMLCh ch = (XMLCh) path[i];
+ if (ch == '/')
+ npath.push_back((XMLCh)'\\');
+ else
+ npath.push_back(ch);
+ }
+#else
+ npath = path;
+#endif
+ return npath;
+}
+
bool URI::isAbsolute() const
{
@@ -529,7 +555,12 @@ int URI::parseHierarchicalPart(int p0)
//# Are we absolute?
ch = peek(p);
- if (ch == '/')
+ if (isLetter(ch) && peek(p+1)==':')
+ {
+ absolute = true;
+ path.push_back((XMLCh)'/');
+ }
+ else if (ch == '/')
{
absolute = true;
if (p>p0) //in other words, if '/' is not the first char
@@ -643,7 +674,16 @@ bool URI::parse(const DOMString &str)
{
parselen = str.size();
- DOMString tmp = str;
+
+ DOMString tmp;
+ for (unsigned int i=0 ; i<str.size() ; i++)
+ {
+ XMLCh ch = (XMLCh) str[i];
+ if (ch == '\\')
+ tmp.push_back((XMLCh)'/');
+ else
+ tmp.push_back(ch);
+ }
parsebuf = (char *) tmp.c_str();