makes the relative path out of any
| 313 | |
| 314 | // makes the relative path out of any |
| 315 | CString NormalizePath(const char* szPath) |
| 316 | { |
| 317 | char szCurDir[0x800]=""; |
| 318 | GetCurrentDirectory(sizeof(szCurDir),szCurDir); |
| 319 | strcat(szCurDir, "/"); |
| 320 | |
| 321 | char szFullPath[0x800]; |
| 322 | if (!_fullpath(szFullPath, szPath, sizeof(szFullPath))) |
| 323 | strcpy (szFullPath, szPath); |
| 324 | |
| 325 | |
| 326 | char* p, *q; |
| 327 | CString sRes = szPath; |
| 328 | for (p = szCurDir, q = szFullPath; *p && *q; ++p, ++q) |
| 329 | { |
| 330 | if (tolower(*p)==tolower(*q)) |
| 331 | continue; |
| 332 | |
| 333 | if ((*p=='/'||*p=='\\')&&(*q=='/'||*q=='\\')) |
| 334 | continue; |
| 335 | |
| 336 | return sRes; |
| 337 | } |
| 338 | |
| 339 | if (*p) |
| 340 | return szPath; |
| 341 | |
| 342 | return q; // return whatever has left after truncating the leading path |
| 343 | } |
| 344 | |
| 345 | ////////////////////////////////////////////////////////////////////////// |
| 346 | bool ResourceCompiler::CompileFile( const char *filename, const char *outroot, const char *outpath ) |