| 6187 | } |
| 6188 | |
| 6189 | CEStr CConEmuMain::LoadConsoleBatch(LPCWSTR asSource, RConStartArgsEx* pArgs /*= nullptr*/) |
| 6190 | { |
| 6191 | if (pArgs && pArgs->pszTaskName) |
| 6192 | { |
| 6193 | SafeFree(pArgs->pszTaskName); |
| 6194 | } |
| 6195 | |
| 6196 | const wchar_t cType = IsConsoleBatchOrTask(asSource); |
| 6197 | if (!cType) |
| 6198 | { |
| 6199 | _ASSERTE(asSource && (*asSource==CmdFilePrefix || *asSource==TaskBracketLeft)); |
| 6200 | return {}; |
| 6201 | } |
| 6202 | |
| 6203 | // If task name is quoted |
| 6204 | CmdArg lsTemp; |
| 6205 | if (asSource && (*asSource == L'"')) |
| 6206 | { |
| 6207 | LPCWSTR pszTemp; |
| 6208 | if ((pszTemp = NextArg(asSource, lsTemp))) |
| 6209 | { |
| 6210 | asSource = lsTemp.c_str(); |
| 6211 | |
| 6212 | pszTemp = SkipNonPrintable(pszTemp); |
| 6213 | if (pszTemp && *pszTemp) |
| 6214 | { |
| 6215 | // #Tasks Is it still true? |
| 6216 | _ASSERTE((!pszTemp || !*pszTemp) && "Task arguments are not supported yet"); |
| 6217 | } |
| 6218 | } |
| 6219 | } |
| 6220 | |
| 6221 | CEStr result; |
| 6222 | |
| 6223 | switch (cType) |
| 6224 | { |
| 6225 | case CmdFilePrefix: |
| 6226 | // it's a "batch" file for simultaneous run of several consoles |
| 6227 | result = LoadConsoleBatch_File(asSource); |
| 6228 | break; |
| 6229 | |
| 6230 | case TaskBracketLeft: |
| 6231 | case AutoStartTaskLeft: // AutoStartTaskName |
| 6232 | // The Task name |
| 6233 | result = LoadConsoleBatch_Task(asSource, pArgs); |
| 6234 | break; |
| 6235 | |
| 6236 | case DropLnkPrefix: |
| 6237 | // We get here when on ConEmu (or it's desktop shortcut) user |
| 6238 | // drops (D&D) one or several other items. |
| 6239 | result = LoadConsoleBatch_Drops(asSource); |
| 6240 | break; |
| 6241 | |
| 6242 | #ifdef _DEBUG |
| 6243 | default: |
| 6244 | _ASSERTE(FALSE && "Unsupported type of Task/Batch"); |
| 6245 | #endif |
| 6246 | } |
no test coverage detected