| 1353 | |
| 1354 | |
| 1355 | ResultType Script::Reload(bool aDisplayErrors) |
| 1356 | { |
| 1357 | // The new instance we're about to start will tell our process to stop, or it will display |
| 1358 | // a syntax error or some other error, in which case our process will still be running: |
| 1359 | #ifdef AUTOHOTKEYSC |
| 1360 | // This is here in case a compiled script ever uses the Reload function. Since the "Reload Script" |
| 1361 | // tray menu item is not available for compiled scripts, it can't be called from there. |
| 1362 | return g_script.ActionExec(mOurEXE, _T("/restart"), g_WorkingDirOrig, aDisplayErrors); |
| 1363 | #else |
| 1364 | if (mKind == ScriptKindStdIn) |
| 1365 | return OK; |
| 1366 | TCHAR arg_string[UorA(MAX_WIDE_PATH, MAX_PATH * 2 + 16)]; // MAX_WIDEPATH coincides with the CreateProcess command line length limit (+1). |
| 1367 | if (mCmdLineInclude) |
| 1368 | sntprintf(arg_string, _countof(arg_string), _T("/include \"%s\" "), mCmdLineInclude); |
| 1369 | else |
| 1370 | *arg_string = '\0'; |
| 1371 | sntprintfcat(arg_string, _countof(arg_string), _T("/restart /script \"%s\""), Line::sSourceFile[0]); |
| 1372 | return g_script.ActionExec(mOurEXE, arg_string, g_WorkingDirOrig, aDisplayErrors); |
| 1373 | #endif |
| 1374 | } |
| 1375 | |
| 1376 | |
| 1377 |
no test coverage detected