| 902 | |
| 903 | |
| 904 | void CommandData::ProcessCommand() |
| 905 | { |
| 906 | #ifndef SFX_MODULE |
| 907 | |
| 908 | const wchar *SingleCharCommands=L"FUADPXETK"; |
| 909 | if (Command[0]!=0 && Command[1]!=0 && wcschr(SingleCharCommands,Command[0])!=NULL || *ArcName==0) |
| 910 | OutHelp(*Command==0 ? RARX_SUCCESS:RARX_USERERROR); // Return 'success' for 'rar' without parameters. |
| 911 | |
| 912 | const wchar *ArcExt=GetExt(ArcName); |
| 913 | #ifdef _UNIX |
| 914 | if (ArcExt==NULL && (!FileExist(ArcName) || IsDir(GetFileAttr(ArcName)))) |
| 915 | wcsncatz(ArcName,L".rar",ASIZE(ArcName)); |
| 916 | #else |
| 917 | if (ArcExt==NULL) |
| 918 | wcsncatz(ArcName,L".rar",ASIZE(ArcName)); |
| 919 | #endif |
| 920 | // Treat arcname.part1 as arcname.part1.rar. |
| 921 | if (ArcExt!=NULL && wcsnicomp(ArcExt,L".part",5)==0 && IsDigit(ArcExt[5]) && |
| 922 | !FileExist(ArcName)) |
| 923 | { |
| 924 | wchar Name[NM]; |
| 925 | wcsncpyz(Name,ArcName,ASIZE(Name)); |
| 926 | wcsncatz(Name,L".rar",ASIZE(Name)); |
| 927 | if (FileExist(Name)) |
| 928 | wcsncpyz(ArcName,Name,ASIZE(ArcName)); |
| 929 | } |
| 930 | |
| 931 | if (wcschr(L"AFUMD",*Command)==NULL) |
| 932 | { |
| 933 | if (GenerateArcName) |
| 934 | { |
| 935 | const wchar *Mask=*GenerateMask!=0 ? GenerateMask:DefGenerateMask; |
| 936 | GenerateArchiveName(ArcName,ASIZE(ArcName),Mask,false); |
| 937 | } |
| 938 | |
| 939 | StringList ArcMasks; |
| 940 | ArcMasks.AddString(ArcName); |
| 941 | ScanTree Scan(&ArcMasks,Recurse,SaveSymLinks,SCAN_SKIPDIRS); |
| 942 | FindData FindData; |
| 943 | while (Scan.GetNext(&FindData)==SCAN_SUCCESS) |
| 944 | AddArcName(FindData.Name); |
| 945 | } |
| 946 | else |
| 947 | AddArcName(ArcName); |
| 948 | #endif |
| 949 | |
| 950 | switch(Command[0]) |
| 951 | { |
| 952 | case 'P': |
| 953 | case 'X': |
| 954 | case 'E': |
| 955 | case 'T': |
| 956 | { |
| 957 | CmdExtract Extract(this); |
| 958 | Extract.DoExtract(); |
| 959 | } |
| 960 | break; |
| 961 | #ifndef SILENT |
no test coverage detected