| 145 | } |
| 146 | |
| 147 | string Path::GetAbsolutePath(const std::string & path) |
| 148 | { |
| 149 | if (path.empty()) |
| 150 | return GetWorkingDirectory(); |
| 151 | |
| 152 | if (path == ".") |
| 153 | return GetWorkingDirectory(); |
| 154 | |
| 155 | if (String::StartsWith(path, "/")) |
| 156 | return RemoveDotSegments(path); |
| 157 | |
| 158 | #if defined(_WIN32) |
| 159 | if (isalpha(path[0]) && path.substr(1, 2) == ":\\") |
| 160 | return RemoveDotSegments(path); |
| 161 | #endif |
| 162 | |
| 163 | return RemoveDotSegments(Join(GetWorkingDirectory(), path)); |
| 164 | } |
| 165 | |
| 166 | static const string dot("."); |
| 167 | static const string dot_dot(".."); |