| 144 | } |
| 145 | |
| 146 | std::string getNormalizedPath(std::string Path) { |
| 147 | |
| 148 | std::vector<fs::path> Tokens; |
| 149 | |
| 150 | fs::path FSPath(Path); |
| 151 | for (auto S = FSPath.begin(), E = FSPath.end(); S != E; ++S) { |
| 152 | if (*S == ".") |
| 153 | continue; |
| 154 | |
| 155 | if (*S == ".." && Tokens.size() > 0) { |
| 156 | Tokens.pop_back(); |
| 157 | continue; |
| 158 | } |
| 159 | |
| 160 | Tokens.push_back(*S); |
| 161 | } |
| 162 | |
| 163 | fs::path Result; |
| 164 | for (auto &Token : Tokens) |
| 165 | Result /= Token; |
| 166 | |
| 167 | return Result.string(); |
| 168 | } |
| 169 | |
| 170 | std::string getParentPath(std::string Path) { |
| 171 |