| 23 | |
| 24 | |
| 25 | void CmdExtract::DoExtract() |
| 26 | { |
| 27 | #if defined(_WIN_ALL) && !defined(SFX_MODULE) && !defined(SILENT) |
| 28 | Fat32=NotFat32=false; |
| 29 | #endif |
| 30 | PasswordCancelled=false; |
| 31 | DataIO.SetCurrentCommand(Cmd->Command[0]); |
| 32 | |
| 33 | FindData FD; |
| 34 | while (Cmd->GetArcName(ArcName,ASIZE(ArcName))) |
| 35 | if (FindFile::FastFind(ArcName,&FD)) |
| 36 | DataIO.TotalArcSize+=FD.Size; |
| 37 | |
| 38 | Cmd->ArcNames.Rewind(); |
| 39 | while (Cmd->GetArcName(ArcName,ASIZE(ArcName))) |
| 40 | { |
| 41 | if (Cmd->ManualPassword) |
| 42 | Cmd->Password.Clean(); // Clean user entered password before processing next archive. |
| 43 | |
| 44 | ReconstructDone=false; // Must be reset here, not in ExtractArchiveInit(). |
| 45 | while (true) |
| 46 | { |
| 47 | EXTRACT_ARC_CODE Code=ExtractArchive(); |
| 48 | if (Code!=EXTRACT_ARC_REPEAT) |
| 49 | break; |
| 50 | } |
| 51 | if (FindFile::FastFind(ArcName,&FD)) |
| 52 | DataIO.ProcessedArcSize+=FD.Size; |
| 53 | } |
| 54 | |
| 55 | // Clean user entered password. Not really required, just for extra safety. |
| 56 | if (Cmd->ManualPassword) |
| 57 | Cmd->Password.Clean(); |
| 58 | |
| 59 | if (TotalFileCount==0 && Cmd->Command[0]!='I' && |
| 60 | ErrHandler.GetErrorCode()!=RARX_BADPWD) // Not in case of wrong archive password. |
| 61 | { |
| 62 | if (!PasswordCancelled) |
| 63 | uiMsg(UIERROR_NOFILESTOEXTRACT,ArcName); |
| 64 | |
| 65 | // Other error codes may explain a reason of "no files extracted" clearer, |
| 66 | // so set it only if no other errors found (wrong mask set by user). |
| 67 | if (ErrHandler.GetErrorCode()==RARX_SUCCESS) |
| 68 | ErrHandler.SetErrorCode(RARX_NOFILES); |
| 69 | } |
| 70 | else |
| 71 | if (!Cmd->DisableDone) |
| 72 | if (Cmd->Command[0]=='I') |
| 73 | mprintf(St(MDone)); |
| 74 | else |
| 75 | if (ErrHandler.GetErrorCount()==0) |
| 76 | mprintf(St(MExtrAllOk)); |
| 77 | else |
| 78 | mprintf(St(MExtrTotalErr),ErrHandler.GetErrorCount()); |
| 79 | } |
| 80 | |
| 81 | |
| 82 | void CmdExtract::ExtractArchiveInit(Archive &Arc) |
no test coverage detected