unrarsrc  6.1.7
About: unrar extracts, views and tests the contents of archives created with the RAR archiver.
  Fossies Dox: unrarsrc-6.1.7.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

hardlinks.cpp
Go to the documentation of this file.
1bool ExtractHardlink(CommandData *Cmd,wchar *NameNew,wchar *NameExisting,size_t NameExistingSize)
2{
3 SlashToNative(NameExisting,NameExisting,NameExistingSize); // Not needed for RAR 5.1+ archives.
4
5 if (!FileExist(NameExisting))
6 {
10 return false;
11 }
12 CreatePath(NameNew,true,Cmd->DisableNames);
13
14#ifdef _WIN_ALL
15 bool Success=CreateHardLink(NameNew,NameExisting,NULL)!=0;
16 if (!Success)
17 {
21 }
22 return Success;
23#elif defined(_UNIX)
24 char NameExistingA[NM],NameNewA[NM];
25 WideToChar(NameExisting,NameExistingA,ASIZE(NameExistingA));
26 WideToChar(NameNew,NameNewA,ASIZE(NameNewA));
27 bool Success=link(NameExistingA,NameNewA)==0;
28 if (!Success)
29 {
33 }
34 return Success;
35#else
36 return false;
37#endif
38}
39
ErrorHandler ErrHandler
void SetErrorCode(RAR_EXIT Code)
Definition: errhnd.cpp:243
void SysErrMsg()
Definition: errhnd.cpp:368
bool DisableNames
Definition: options.hpp:138
@ RARX_CREATE
Definition: errhnd.hpp:15
bool CreatePath(const wchar *Path, bool SkipLastName, bool Silent)
Definition: filefn.cpp:41
bool FileExist(const wchar *Name)
Definition: filefn.cpp:190
void SlashToNative(const char *SrcName, char *DestName, size_t MaxLength)
Definition: pathfn.hpp:40
#define ASIZE(x)
Definition: rardefs.hpp:10
wchar_t wchar
Definition: rartypes.hpp:13
void uiMsg(UIMESSAGE_CODE Code)
Definition: ui.hpp:148
@ UIERROR_HLINKCREATE
Definition: ui.hpp:16
@ UIERROR_NOLINKTARGET
Definition: ui.hpp:17
bool WideToChar(const wchar *Src, char *Dest, size_t DestSize)
Definition: unicode.cpp:20