| 49 | |
| 50 | #if !defined(SFX_MODULE) |
| 51 | void CommandData::ParseCommandLine(bool Preprocess,int argc, char *argv[]) |
| 52 | { |
| 53 | *Command=0; |
| 54 | NoMoreSwitches=false; |
| 55 | #ifdef CUSTOM_CMDLINE_PARSER |
| 56 | // In Windows we may prefer to implement our own command line parser |
| 57 | // to avoid replacing \" by " in standard parser. Such replacing corrupts |
| 58 | // destination paths like "dest path\" in extraction commands. |
| 59 | // Also our own parser is Unicode compatible. |
| 60 | const wchar *CmdLine=GetCommandLine(); |
| 61 | |
| 62 | wchar *Par; |
| 63 | for (bool FirstParam=true;;FirstParam=false) |
| 64 | { |
| 65 | if ((CmdLine=AllocCmdParam(CmdLine,&Par))==NULL) |
| 66 | break; |
| 67 | if (!FirstParam) // First parameter is the executable name. |
| 68 | if (Preprocess) |
| 69 | PreprocessArg(Par); |
| 70 | else |
| 71 | ParseArg(Par); |
| 72 | free(Par); |
| 73 | } |
| 74 | #else |
| 75 | Array<wchar> Arg; |
| 76 | for (int I=1;I<argc;I++) |
| 77 | { |
| 78 | Arg.Alloc(strlen(argv[I])+1); |
| 79 | CharToWide(argv[I],&Arg[0],Arg.Size()); |
| 80 | if (Preprocess) |
| 81 | PreprocessArg(&Arg[0]); |
| 82 | else |
| 83 | ParseArg(&Arg[0]); |
| 84 | } |
| 85 | #endif |
| 86 | if (!Preprocess) |
| 87 | ParseDone(); |
| 88 | } |
| 89 | #endif |
| 90 | |
| 91 |
no test coverage detected