MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / GetPathRoot

Function GetPathRoot

Libraries/unrar/pathfn.cpp:586–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584
585
586void GetPathRoot(const wchar *Path,wchar *Root,size_t MaxSize)
587{
588 *Root=0;
589 if (IsDriveLetter(Path))
590 swprintf(Root,MaxSize,L"%c:\\",*Path);
591 else
592 if (Path[0]=='\\' && Path[1]=='\\')
593 {
594 const wchar *Slash=wcschr(Path+2,'\\');
595 if (Slash!=NULL)
596 {
597 size_t Length;
598 if ((Slash=wcschr(Slash+1,'\\'))!=NULL)
599 Length=Slash-Path+1;
600 else
601 Length=wcslen(Path);
602 if (Length>=MaxSize)
603 Length=0;
604 wcsncpy(Root,Path,Length);
605 Root[Length]=0;
606 }
607 }
608}
609
610
611int ParseVersionFileName(wchar *Name,bool Truncate)

Callers 2

IsRemovableFunction · 0.85
IsFATFunction · 0.85

Calls 1

IsDriveLetterFunction · 0.85

Tested by

no test coverage detected