MCPcopy Create free account
hub / github.com/git/git / normalize_ntpath

Function normalize_ntpath

compat/mingw.c:429–451  ·  view source on GitHub ↗

Normalizes NT paths as returned by some low-level APIs. */

Source from the content-addressed store, hash-verified

427
428/* Normalizes NT paths as returned by some low-level APIs. */
429static wchar_t *normalize_ntpath(wchar_t *wbuf)
430{
431 int i;
432 /* fix absolute path prefixes */
433 if (wbuf[0] == '\\') {
434 /* strip NT namespace prefixes */
435 if (!wcsncmp(wbuf, L"\\??\\", 4) ||
436 !wcsncmp(wbuf, L"\\\\?\\", 4))
437 wbuf += 4;
438 else if (!wcsnicmp(wbuf, L"\\DosDevices\\", 12))
439 wbuf += 12;
440 /* replace remaining '...UNC\' with '\\' */
441 if (!wcsnicmp(wbuf, L"UNC\\", 4)) {
442 wbuf += 2;
443 *wbuf = '\\';
444 }
445 }
446 /* convert backslashes to slashes */
447 for (i = 0; wbuf[i]; i++)
448 if (wbuf[i] == '\\')
449 wbuf[i] = '/';
450 return wbuf;
451}
452
453/*
454 * Use SetFileInformationByHandle(FileDispositionInfo) to force legacy

Callers 3

mingw_chdirFunction · 0.85
read_reparse_pointFunction · 0.85
mingw_getcwdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected