| 112 | } |
| 113 | |
| 114 | string Uri::nativePath() const |
| 115 | { |
| 116 | if (!mScheme.empty() && mScheme != "file") |
| 117 | return string(); |
| 118 | |
| 119 | string currentPath(mPath); |
| 120 | string native_path; |
| 121 | #if _WIN32 |
| 122 | if (!mAuthority.empty()) |
| 123 | native_path += string("\\\\") + mAuthority; // UNC path |
| 124 | |
| 125 | // Replace two leading slashes with one leading slash, so that |
| 126 | // ///otherComputer/file.dae becomes //otherComputer/file.dae and |
| 127 | // //folder/file.dae becomes /folder/file.dae |
| 128 | if (currentPath.length() >= 2 && currentPath[0] == '/' && currentPath[1] == '/') |
| 129 | currentPath.erase(0, 1); |
| 130 | |
| 131 | // Convert "/C:/" to "C:/" |
| 132 | if (currentPath.length() >= 3 && currentPath[0] == '/' && currentPath[2] == ':') |
| 133 | currentPath.erase(0, 1); |
| 134 | |
| 135 | // Convert forward slashes to back slashes |
| 136 | currentPath = String::Replace(currentPath, "/", "\\"); |
| 137 | #endif |
| 138 | native_path += currentPath; |
| 139 | |
| 140 | // Replace % encoded characters |
| 141 | return Uri::Decode(native_path); |
| 142 | } |
| 143 | |
| 144 | void Uri::clear() |
| 145 | { |