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

Function ConvertNameToFull

Libraries/unrar/pathfn.cpp:522–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520
521
522void ConvertNameToFull(const wchar *Src,wchar *Dest,size_t MaxSize)
523{
524 if (Src==NULL || *Src==0)
525 {
526 if (MaxSize>0)
527 *Dest=0;
528 return;
529 }
530#ifdef _WIN_ALL
531 {
532 wchar FullName[NM],*NamePtr;
533 DWORD Code=GetFullPathName(Src,ASIZE(FullName),FullName,&NamePtr);
534 if (Code==0 || Code>ASIZE(FullName))
535 {
536 wchar LongName[NM];
537 if (GetWinLongPath(Src,LongName,ASIZE(LongName)))
538 Code=GetFullPathName(LongName,ASIZE(FullName),FullName,&NamePtr);
539 }
540 if (Code!=0 && Code<ASIZE(FullName))
541 wcsncpyz(Dest,FullName,MaxSize);
542 else
543 if (Src!=Dest)
544 wcsncpyz(Dest,Src,MaxSize);
545 }
546#elif defined(_UNIX)
547 if (IsFullPath(Src))
548 *Dest=0;
549 else
550 {
551 char CurDirA[NM];
552 if (getcwd(CurDirA,ASIZE(CurDirA))==NULL)
553 *CurDirA=0;
554 CharToWide(CurDirA,Dest,MaxSize);
555 AddEndSlash(Dest,MaxSize);
556 }
557 wcsncatz(Dest,Src,MaxSize);
558#else
559 wcsncpyz(Dest,Src,MaxSize);
560#endif
561}
562
563
564bool IsFullPath(const wchar *Path)

Callers 2

CheckArgsMethod · 0.85
ScanErrorMethod · 0.85

Calls 6

GetWinLongPathFunction · 0.85
wcsncpyzFunction · 0.85
CharToWideFunction · 0.85
AddEndSlashFunction · 0.85
wcsncatzFunction · 0.85
IsFullPathFunction · 0.70

Tested by

no test coverage detected