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

Function LinkInPath

Libraries/unrar/extinfo.cpp:97–112  ·  view source on GitHub ↗

Check if all existing path components are directories and not links.

Source from the content-addressed store, hash-verified

95
96// Check if all existing path components are directories and not links.
97static bool LinkInPath(const wchar *Name)
98{
99 wchar Path[NM];
100 if (wcslen(Name)>=ASIZE(Path))
101 return true; // It should not be that long, skip.
102 wcsncpyz(Path,Name,ASIZE(Path));
103 for (wchar *s=Path+wcslen(Path)-1;s>Path;s--)
104 if (IsPathDiv(*s))
105 {
106 *s=0;
107 FindData FD;
108 if (FindFile::FastFind(Path,&FD,true) && (FD.IsLink || !FD.IsDir))
109 return true;
110 }
111 return false;
112}
113
114
115bool IsRelativeSymlinkSafe(CommandData *Cmd,const wchar *SrcName,const wchar *PrepSrcName,const wchar *TargetName)

Callers 1

IsRelativeSymlinkSafeFunction · 0.85

Calls 2

wcsncpyzFunction · 0.85
IsPathDivFunction · 0.85

Tested by

no test coverage detected