| 1215 | } |
| 1216 | |
| 1217 | string GenerateParallelPath(const char* base, const char* target, const char* postfix, Path asset) { |
| 1218 | LOG_ASSERT(strlen(base) > 0); |
| 1219 | LOG_ASSERT(strlen(target) > 0); |
| 1220 | LOG_ASSERT(base[0] != '/'); |
| 1221 | LOG_ASSERT(base[strlen(base) - 1] != '/'); |
| 1222 | LOG_ASSERT(target[0] != '/'); |
| 1223 | LOG_ASSERT(target[strlen(target) - 1] != '/'); |
| 1224 | LOG_ASSERT(IsPathSane(base)); |
| 1225 | LOG_ASSERT(IsPathSane(target)); |
| 1226 | LOG_ASSERT(asset.isValid()); |
| 1227 | |
| 1228 | Path shortest_path = FindShortestPath2(asset.GetFullPath()); |
| 1229 | string shortest_path_orig_folder = SplitPathFileName(shortest_path.GetOriginalPath()).first; |
| 1230 | string filename = RemoveFileEnding(SplitPathFileName(shortest_path.GetOriginalPath()).second); |
| 1231 | |
| 1232 | if (pstrmtch(shortest_path_orig_folder.c_str(), base, strlen(base))) { |
| 1233 | if (shortest_path_orig_folder.size() > strlen(base) + 1) { |
| 1234 | if (shortest_path_orig_folder[strlen(base)] == '/') { |
| 1235 | shortest_path_orig_folder = &shortest_path_orig_folder.c_str()[strlen(base) + 1]; |
| 1236 | } else { |
| 1237 | shortest_path_orig_folder = "unknown_source"; |
| 1238 | } |
| 1239 | } else { |
| 1240 | shortest_path_orig_folder = ""; |
| 1241 | } |
| 1242 | } else { |
| 1243 | shortest_path_orig_folder = "unknown_source"; |
| 1244 | } |
| 1245 | |
| 1246 | char nav_path[kPathSize]; |
| 1247 | if (shortest_path_orig_folder.size() > 0) { |
| 1248 | FormatString(nav_path, kPathSize, "%s/%s/%s%s", target, shortest_path_orig_folder.c_str(), filename.c_str(), postfix); |
| 1249 | } else { |
| 1250 | FormatString(nav_path, kPathSize, "%s/%s%s", target, filename.c_str(), postfix); |
| 1251 | } |
| 1252 | |
| 1253 | return string(nav_path); |
| 1254 | } |
| 1255 | |
| 1256 | uint64_t GetFileSize(const Path& file) { |
| 1257 | if (file.isValid()) { |
no test coverage detected