MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / NormalizePath

Function NormalizePath

ResourceCompiler/ResourceCompiler.cpp:315–343  ·  view source on GitHub ↗

makes the relative path out of any

Source from the content-addressed store, hash-verified

313
314// makes the relative path out of any
315CString 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//////////////////////////////////////////////////////////////////////////
346bool ResourceCompiler::CompileFile( const char *filename, const char *outroot, const char *outpath )

Callers 1

CompileFileMethod · 0.85

Calls 1

tolowerFunction · 0.85

Tested by

no test coverage detected