mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 10:25:45 -04:00
Initial community commit
This commit is contained in:
39
Src/external_dependencies/openmpt-trunk/include/unrar/hardlinks.cpp
vendored
Normal file
39
Src/external_dependencies/openmpt-trunk/include/unrar/hardlinks.cpp
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
bool ExtractHardlink(CommandData *Cmd,wchar *NameNew,wchar *NameExisting,size_t NameExistingSize)
|
||||
{
|
||||
SlashToNative(NameExisting,NameExisting,NameExistingSize); // Not needed for RAR 5.1+ archives.
|
||||
|
||||
if (!FileExist(NameExisting))
|
||||
{
|
||||
uiMsg(UIERROR_HLINKCREATE,NameNew);
|
||||
uiMsg(UIERROR_NOLINKTARGET);
|
||||
ErrHandler.SetErrorCode(RARX_CREATE);
|
||||
return false;
|
||||
}
|
||||
CreatePath(NameNew,true,Cmd->DisableNames);
|
||||
|
||||
#ifdef _WIN_ALL
|
||||
bool Success=CreateHardLink(NameNew,NameExisting,NULL)!=0;
|
||||
if (!Success)
|
||||
{
|
||||
uiMsg(UIERROR_HLINKCREATE,NameNew);
|
||||
ErrHandler.SysErrMsg();
|
||||
ErrHandler.SetErrorCode(RARX_CREATE);
|
||||
}
|
||||
return Success;
|
||||
#elif defined(_UNIX)
|
||||
char NameExistingA[NM],NameNewA[NM];
|
||||
WideToChar(NameExisting,NameExistingA,ASIZE(NameExistingA));
|
||||
WideToChar(NameNew,NameNewA,ASIZE(NameNewA));
|
||||
bool Success=link(NameExistingA,NameNewA)==0;
|
||||
if (!Success)
|
||||
{
|
||||
uiMsg(UIERROR_HLINKCREATE,NameNew);
|
||||
ErrHandler.SysErrMsg();
|
||||
ErrHandler.SetErrorCode(RARX_CREATE);
|
||||
}
|
||||
return Success;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user