| Index: src/DefaultFileSystem.cpp |
| =================================================================== |
| --- a/src/DefaultFileSystem.cpp |
| +++ b/src/DefaultFileSystem.cpp |
| @@ -12,6 +12,7 @@ |
| #ifndef S_ISDIR |
| #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) |
| #include <Shlobj.h> |
| +#include <Shlwapi.h> |
| #endif |
| #ifndef S_ISREG |
| @@ -91,19 +92,30 @@ |
| std::string DefaultFileSystem::Resolve(const std::string& path) const |
| { |
| - return basePath + "\\" + path; |
| + if (basePath == "") |
| + { |
| + return path; |
| + } |
| + else |
| + { |
| + if (PathIsRelative(Utils::ToUTF16String(path, path.length()).c_str())) |
|
Wladimir Palant
2013/05/06 06:18:30
This is Windows-specific and won't compile on othe
Wladimir Palant
2013/05/06 06:19:51
Oops, exactly the other way round of course:
i
|
| + { |
| + return basePath + PATH_SEPARATOR + path; |
| + } |
| + else |
| + { |
| + return path; |
| + } |
| + } |
| } |
| void DefaultFileSystem::SetBasePath(const std::string& path) |
| { |
| + basePath = path; |
| - if (path.rfind('\\') == (path.length() - 1)) |
| + if ((*basePath.rbegin() == PATH_SEPARATOR)) |
|
Wladimir Palant
2013/05/06 06:18:30
Nit: You seem to have an extra pair parentheses he
|
| { |
| - basePath = path.substr(0, path.length() - 1); |
| - } |
| - else |
| - { |
| - basePath = path; |
| + basePath.pop_back(); |
| } |
| } |