| 1045 | |
| 1046 | |
| 1047 | void CmdExtract::ExtrCreateDir(Archive &Arc,const wchar *ArcFileName) |
| 1048 | { |
| 1049 | if (Cmd->Test) |
| 1050 | { |
| 1051 | mprintf(St(MExtrTestFile),ArcFileName); |
| 1052 | mprintf(L" %s",St(MOk)); |
| 1053 | return; |
| 1054 | } |
| 1055 | |
| 1056 | MKDIR_CODE MDCode=MakeDir(DestFileName,!Cmd->IgnoreGeneralAttr,Arc.FileHead.FileAttr); |
| 1057 | bool DirExist=false; |
| 1058 | if (MDCode!=MKDIR_SUCCESS) |
| 1059 | { |
| 1060 | DirExist=FileExist(DestFileName); |
| 1061 | if (DirExist && !IsDir(GetFileAttr(DestFileName))) |
| 1062 | { |
| 1063 | // File with name same as this directory exists. Propose user |
| 1064 | // to overwrite it. |
| 1065 | bool UserReject; |
| 1066 | FileCreate(Cmd,NULL,DestFileName,ASIZE(DestFileName),&UserReject,Arc.FileHead.UnpSize,&Arc.FileHead.mtime); |
| 1067 | DirExist=false; |
| 1068 | } |
| 1069 | if (!DirExist) |
| 1070 | { |
| 1071 | CreatePath(DestFileName,true); |
| 1072 | MDCode=MakeDir(DestFileName,!Cmd->IgnoreGeneralAttr,Arc.FileHead.FileAttr); |
| 1073 | if (MDCode!=MKDIR_SUCCESS) |
| 1074 | { |
| 1075 | wchar OrigName[ASIZE(DestFileName)]; |
| 1076 | wcsncpyz(OrigName,DestFileName,ASIZE(OrigName)); |
| 1077 | MakeNameUsable(DestFileName,true); |
| 1078 | CreatePath(DestFileName,true); |
| 1079 | MDCode=MakeDir(DestFileName,!Cmd->IgnoreGeneralAttr,Arc.FileHead.FileAttr); |
| 1080 | #ifndef SFX_MODULE |
| 1081 | if (MDCode==MKDIR_SUCCESS) |
| 1082 | uiMsg(UIERROR_RENAMING,Arc.FileName,OrigName,DestFileName); |
| 1083 | #endif |
| 1084 | } |
| 1085 | } |
| 1086 | } |
| 1087 | if (MDCode==MKDIR_SUCCESS) |
| 1088 | { |
| 1089 | mprintf(St(MCreatDir),DestFileName); |
| 1090 | mprintf(L" %s",St(MOk)); |
| 1091 | PrevProcessed=true; |
| 1092 | } |
| 1093 | else |
| 1094 | if (DirExist) |
| 1095 | { |
| 1096 | if (!Cmd->IgnoreGeneralAttr) |
| 1097 | SetFileAttr(DestFileName,Arc.FileHead.FileAttr); |
| 1098 | PrevProcessed=true; |
| 1099 | } |
| 1100 | else |
| 1101 | { |
| 1102 | uiMsg(UIERROR_DIRCREATE,Arc.FileName,DestFileName); |
| 1103 | ErrHandler.SysErrMsg(); |
| 1104 | #ifdef RARDLL |
nothing calls this directly
no test coverage detected