| 91 | |
| 92 | #if !defined(SFX_MODULE) |
| 93 | void CommandData::ParseArg(wchar *Arg) |
| 94 | { |
| 95 | if (IsSwitch(*Arg) && !NoMoreSwitches) |
| 96 | if (Arg[1]=='-' && Arg[2]==0) |
| 97 | NoMoreSwitches=true; |
| 98 | else |
| 99 | ProcessSwitch(Arg+1); |
| 100 | else |
| 101 | if (*Command==0) |
| 102 | { |
| 103 | wcsncpyz(Command,Arg,ASIZE(Command)); |
| 104 | |
| 105 | |
| 106 | *Command=toupperw(*Command); |
| 107 | // 'I' and 'S' commands can contain case sensitive strings after |
| 108 | // the first character, so we must not modify their case. |
| 109 | // 'S' can contain SFX name, which case is important in Unix. |
| 110 | if (*Command!='I' && *Command!='S') |
| 111 | wcsupper(Command); |
| 112 | } |
| 113 | else |
| 114 | if (*ArcName==0) |
| 115 | wcsncpyz(ArcName,Arg,ASIZE(ArcName)); |
| 116 | else |
| 117 | { |
| 118 | // Check if last character is the path separator. |
| 119 | size_t Length=wcslen(Arg); |
| 120 | wchar EndChar=Length==0 ? 0:Arg[Length-1]; |
| 121 | bool EndSeparator=IsDriveDiv(EndChar) || IsPathDiv(EndChar); |
| 122 | |
| 123 | wchar CmdChar=toupperw(*Command); |
| 124 | bool Add=wcschr(L"AFUM",CmdChar)!=NULL; |
| 125 | bool Extract=CmdChar=='X' || CmdChar=='E'; |
| 126 | bool Repair=CmdChar=='R' && Command[1]==0; |
| 127 | if (EndSeparator && !Add) |
| 128 | wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath)); |
| 129 | else |
| 130 | if ((Add || CmdChar=='T') && (*Arg!='@' || ListMode==RCLM_REJECT_LISTS)) |
| 131 | FileArgs.AddString(Arg); |
| 132 | else |
| 133 | { |
| 134 | FindData FileData; |
| 135 | bool Found=FindFile::FastFind(Arg,&FileData); |
| 136 | if ((!Found || ListMode==RCLM_ACCEPT_LISTS) && |
| 137 | ListMode!=RCLM_REJECT_LISTS && *Arg=='@' && !IsWildcard(Arg+1)) |
| 138 | { |
| 139 | FileLists=true; |
| 140 | |
| 141 | ReadTextFile(Arg+1,&FileArgs,false,true,FilelistCharset,true,true,true); |
| 142 | |
| 143 | } |
| 144 | else // We use 'destpath\' when extracting and reparing. |
| 145 | if (Found && FileData.IsDir && (Extract || Repair) && *ExtrPath==0) |
| 146 | { |
| 147 | wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath)); |
| 148 | AddEndSlash(ExtrPath,ASIZE(ExtrPath)); |
| 149 | } |
| 150 | else |
nothing calls this directly
no test coverage detected