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

Method ExtrCreateFile

Libraries/unrar/extract.cpp:1125–1171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1123
1124
1125bool CmdExtract::ExtrCreateFile(Archive &Arc,File &CurFile)
1126{
1127 bool Success=true;
1128 wchar Command=Cmd->Command[0];
1129#if !defined(SFX_MODULE)
1130 if (Command=='P')
1131 CurFile.SetHandleType(FILE_HANDLESTD);
1132#endif
1133 if ((Command=='E' || Command=='X') && !Cmd->Test)
1134 {
1135 bool UserReject;
1136 // Specify "write only" mode to avoid OpenIndiana NAS problems
1137 // with SetFileTime and read+write files.
1138 if (!FileCreate(Cmd,&CurFile,DestFileName,ASIZE(DestFileName),&UserReject,Arc.FileHead.UnpSize,&Arc.FileHead.mtime,true))
1139 {
1140 Success=false;
1141 if (!UserReject)
1142 {
1143 ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName);
1144#ifdef RARDLL
1145 Cmd->DllError=ERAR_ECREATE;
1146#endif
1147 if (!IsNameUsable(DestFileName))
1148 {
1149 uiMsg(UIMSG_CORRECTINGNAME,Arc.FileName);
1150
1151 wchar OrigName[ASIZE(DestFileName)];
1152 wcsncpyz(OrigName,DestFileName,ASIZE(OrigName));
1153
1154 MakeNameUsable(DestFileName,true);
1155
1156 CreatePath(DestFileName,true);
1157 if (FileCreate(Cmd,&CurFile,DestFileName,ASIZE(DestFileName),&UserReject,Arc.FileHead.UnpSize,&Arc.FileHead.mtime,true))
1158 {
1159#ifndef SFX_MODULE
1160 uiMsg(UIERROR_RENAMING,Arc.FileName,OrigName,DestFileName);
1161#endif
1162 Success=true;
1163 }
1164 else
1165 ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName);
1166 }
1167 }
1168 }
1169 }
1170 return Success;
1171}
1172
1173
1174bool CmdExtract::CheckUnpVer(Archive &Arc,const wchar *ArcFileName)

Callers

nothing calls this directly

Calls 8

FileCreateFunction · 0.85
IsNameUsableFunction · 0.85
uiMsgFunction · 0.85
wcsncpyzFunction · 0.85
MakeNameUsableFunction · 0.85
CreatePathFunction · 0.85
SetHandleTypeMethod · 0.80
CreateErrorMsgMethod · 0.80

Tested by

no test coverage detected