----------------------------------------------------------------------------- Munge the specified path.
| 283 | //----------------------------------------------------------------------------- |
| 284 | // Munge the specified path. |
| 285 | static void MungePath(char* dest, S32 destSize, |
| 286 | const char* src, const char* absolutePrefix) |
| 287 | { |
| 288 | char tempBuf[MaxPath]; |
| 289 | dStrncpy(dest, src, MaxPath); |
| 290 | |
| 291 | // translate all \ to / |
| 292 | ForwardSlash(dest); |
| 293 | |
| 294 | // if it is relative, make it absolute with the absolutePrefix |
| 295 | if (dest[0] != '/') |
| 296 | { |
| 297 | AssertFatal(absolutePrefix, "Absolute Prefix must not be NULL"); |
| 298 | |
| 299 | dSprintf(tempBuf, MaxPath, "%s/%s", |
| 300 | absolutePrefix, dest); |
| 301 | |
| 302 | // copy the result back into dest |
| 303 | dStrncpy(dest, tempBuf, destSize); |
| 304 | } |
| 305 | |
| 306 | // if the path exists, we're done |
| 307 | struct stat filestat; |
| 308 | if (stat(dest, &filestat) != -1) |
| 309 | return; |
| 310 | |
| 311 | // otherwise munge the case of the path |
| 312 | ResolvePathCaseInsensitive(dest, destSize, true); |
| 313 | } |
| 314 | |
| 315 | //----------------------------------------------------------------------------- |
| 316 | enum |
no test coverage detected