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