194 |
194 |
195 :: =================== |
195 :: =================== |
196 :: Stx bin directory = |
196 :: Stx bin directory = |
197 :: =================== |
197 :: =================== |
198 IF "!stx.stx_bin_dir!" NEQ "" ( |
198 IF "!stx.stx_bin_dir!" NEQ "" ( |
199 CALL :expand !stx.stx_bin_dir! stx_bin_dir |
199 CALL :expand_path !stx.stx_bin_dir! stx.stx_bin_dir |
|
200 IF ERRORLEVEL 1 ( |
|
201 ECHO "[ERROR] -> stx.stx_bin_dir <- variable error in check your configuration file -> !stx.stx_bin_dir! <-" |
|
202 GOTO :EOF |
|
203 ) |
200 ) |
204 ) |
201 |
205 |
202 :: =================================== |
206 :: =================================== |
203 :: Stx quick start and image details = |
207 :: Stx quick start and image details = |
204 :: =================================== |
208 :: =================================== |
205 IF "!stx.image_path!" NEQ "" ( |
209 IF "!stx.image_path!" NEQ "" ( |
206 CALL :expand !stx.image_path! stx.image_path |
210 CALL :expand_path !stx.image_path! stx.image_path |
|
211 IF ERRORLEVEL 1 ( |
|
212 ECHO "[ERROR] -> stx.image_path <- variable error in check your configuration file -> !stx.image_path! <-" |
|
213 GOTO :EOF |
|
214 ) |
207 ) |
215 ) |
208 |
216 |
209 :: ============= |
217 :: ============= |
210 :: Stx logging = |
218 :: Stx logging = |
211 :: ============= |
219 :: ============= |
212 IF "!stx.log_directory!" NEQ "" ( |
220 IF "!stx.log_directory!" NEQ "" ( |
213 CALL :expand !stx.log_directory! stx.log_directory |
221 CALL :expand_path !stx.log_directory! stx.log_directory |
|
222 IF ERRORLEVEL 1 ( |
|
223 ECHO "[ERROR] -> stx.log_directory <- variable error in check your configuration file -> !stx.log_directory! <-" |
|
224 GOTO :EOF |
|
225 ) |
214 ) |
226 ) |
215 |
227 |
216 :: ================================================================================== |
228 :: ================================================================================== |
217 :: Script's internal variables = |
229 :: Script's internal variables = |
218 :: WARNING: DO NOT TOUCH THE SET VALUES BELOW UNLESS YOU KNOW WHAT YOU ARE DOING!!! = |
230 :: WARNING: DO NOT TOUCH THE SET VALUES BELOW UNLESS YOU KNOW WHAT YOU ARE DOING!!! = |
296 :: Add encoding to the suffix = |
308 :: Add encoding to the suffix = |
297 :: ============================ |
309 :: ============================ |
298 :: Allowed values ASCII, UTF8 (default), UTF16 (in Microsoft world that is called Unicode), UTF32 |
310 :: Allowed values ASCII, UTF8 (default), UTF16 (in Microsoft world that is called Unicode), UTF32 |
299 :: Note: If UTF16 is used you can view log file while StX is running, in all other cases you have to close StX before viewing the file |
311 :: Note: If UTF16 is used you can view log file while StX is running, in all other cases you have to close StX before viewing the file |
300 IF "!stx.log_file_encoding!" EQU "ASCII" ( |
312 IF "!stx.log_file_encoding!" EQU "ASCII" ( |
301 SET "stx.log_suffix=_ascii!stx.log_suffix!" |
313 SET "stx.log_suffix="_ascii!stx.log_suffix:"=!"" |
302 ) ELSE IF "!stx.log_file_encoding!" EQU "UTF8" ( |
314 ) ELSE IF "!stx.log_file_encoding!" EQU "UTF8" ( |
303 SET "stx.log_suffix=_utf8!stx.log_suffix!" |
315 SET "stx.log_suffix="_utf8!stx.log_suffix:"=!"" |
304 ) ELSE IF "!stx.log_file_encoding!" EQU "UTF16" ( |
316 ) ELSE IF "!stx.log_file_encoding!" EQU "UTF16" ( |
305 SET "stx.log_suffix=_utf16!stx.log_suffix!" |
317 SET "stx.log_suffix="_utf16!stx.log_suffix:"=!"" |
306 ) ELSE IF "!stx.log_file_encoding!" EQU "UTF32" ( |
318 ) ELSE IF "!stx.log_file_encoding!" EQU "UTF32" ( |
307 SET "stx.log_suffix=_utf32!stx.log_suffix!" |
319 SET "stx.log_suffix="_utf32!stx.log_suffix:"=!"" |
308 ) ELSE ( |
320 ) ELSE ( |
309 SET "message="Invalid log file encoding: !stx.log_file_encoding!. Fix it and run the script again."" |
321 SET "message="Invalid log file encoding: !stx.log_file_encoding!. Fix it and run the script again."" |
310 SET __numeric.exit_value=1 |
322 SET __numeric.exit_value=1 |
311 CALL :exit_sequence !message! |
323 CALL :exit_sequence !message! |
312 GOTO :EOF |
324 GOTO :EOF |
354 :: ******************************************************************************************* |
366 :: ******************************************************************************************* |
355 |
367 |
356 :: ============================================== |
368 :: ============================================== |
357 :: Checking the PowerShell file (.ps1) presence = |
369 :: Checking the PowerShell file (.ps1) presence = |
358 :: ============================================== |
370 :: ============================================== |
359 |
|
360 IF NOT EXIST "!powershell_script_file!" ( |
371 IF NOT EXIST "!powershell_script_file!" ( |
361 SET "message="PowerShell file missing: !powershell_script_path!smalltalk.ps1. Fix it."" |
372 SET "message="PowerShell file missing: !powershell_script_path!smalltalk.ps1. Fix it."" |
362 SET __numeric.exit_value=1 |
373 SET __numeric.exit_value=1 |
363 CALL :exit_sequence !message! |
374 CALL :exit_sequence !message! |
364 GOTO :EOF |
375 GOTO :EOF |
365 ) |
376 ) |
366 |
377 |
367 :: ===================================================================== |
378 |
368 :: Validate __binary for TRUE^/FALSE and if it does not contain spaces = |
379 :: ======================= |
369 :: ===================================================================== |
380 :: Variables' validation = |
370 :: Checks if the variable contains correctly written TRUE^/FALSE |
381 :: ======================= |
371 :: additionally it also checks if additional space was not added by mistake |
|
372 :: var -7 extracts the last 7 characters from var |
|
373 IF "!stx.verify_variables_syntax!" EQU "TRUE" ( |
382 IF "!stx.verify_variables_syntax!" EQU "TRUE" ( |
|
383 REM must be used (inside IF^^!) |
|
384 REM ===================================================================== |
|
385 REM Validate __binary for TRUE^/FALSE and if it does not contain spaces = |
|
386 REM ===================================================================== |
|
387 REM Checks if the variable contains correctly written TRUE^/FALSE |
|
388 REM additionally it also checks if additional space was not added by mistake |
|
389 REM var -7 extracts the last 7 characters from var |
374 FOR /F "tokens=3 delims=^." %%A IN ('SET stx.__binary.') DO ( |
390 FOR /F "tokens=3 delims=^." %%A IN ('SET stx.__binary.') DO ( |
375 SET temp_test=%%A |
391 SET temp_test=%%A |
376 IF "!temp_test:~-5!" EQU "=TRUE" ( |
392 IF "!temp_test:~-5!" EQU "=TRUE" ( |
377 IF "!temp_test!" NEQ "!temp_test: =!" ( |
393 IF "!temp_test!" NEQ "!temp_test: =!" ( |
378 SET __numeric.exit_value=1 |
394 SET __numeric.exit_value=1 |
437 CALL :exit_sequence !first_message! !second_message! |
453 CALL :exit_sequence !first_message! !second_message! |
438 GOTO :EOF |
454 GOTO :EOF |
439 ) |
455 ) |
440 ) |
456 ) |
441 ) |
457 ) |
|
458 REM must be used (inside IF^^!) |
|
459 REM =============================================================== |
|
460 REM Validate path variables to contain double quotes or backslash = |
|
461 REM =============================================================== |
|
462 |
|
463 REM ======================================================== |
|
464 REM Check beginning of the string to contain double quotes = |
|
465 REM ======================================================== |
|
466 REM Checking image variables |
|
467 SET "correct_substring=!stx.image_name:~0,1!" |
|
468 IF !correct_substring! NEQ ^" ( |
|
469 SET __numeric.exit_value=1 |
|
470 SET "message="Incorrect configuration detected missing double quotes at stx.image_name variable: - !stx.image_name! -"" |
|
471 CALL :exit_sequence !message! |
|
472 GOTO :EOF |
|
473 ) |
|
474 SET "correct_substring=!stx.image_suffix:~0,1!" |
|
475 IF !correct_substring! NEQ ^" ( |
|
476 SET __numeric.exit_value=1 |
|
477 SET "message="Incorrect configuration detected missing double quotes at stx.image_suffix variable: - !stx.image_suffix! -"" |
|
478 CALL :exit_sequence !message! |
|
479 GOTO :EOF |
|
480 ) |
|
481 |
|
482 REM Checking logging variables |
|
483 SET "correct_substring=!stx.log_name:~0,1!" |
|
484 IF !correct_substring! NEQ ^" ( |
|
485 SET __numeric.exit_value=1 |
|
486 SET "message="Incorrect configuration detected missing double quotes at stx.log_name variable: - !stx.log_name! -"" |
|
487 CALL :exit_sequence !message! |
|
488 GOTO :EOF |
|
489 ) |
|
490 SET "correct_substring=!stx.log_suffix:~0,1!" |
|
491 IF !correct_substring! NEQ ^" ( |
|
492 SET __numeric.exit_value=1 |
|
493 SET "message="Incorrect configuration detected missing double quotes at stx.log_suffix variable: - !stx.log_suffix! -"" |
|
494 CALL :exit_sequence !message! |
|
495 GOTO :EOF |
|
496 ) |
|
497 SET "correct_substring=!log_filename:~0,1!" |
|
498 IF !correct_substring! NEQ ^" ( |
|
499 SET __numeric.exit_value=1 |
|
500 SET "message="Incorrect configuration detected missing double quotes at log_filename variable: - !log_filename! -"" |
|
501 CALL :exit_sequence !message! |
|
502 GOTO :EOF |
|
503 ) |
|
504 REM clearing temp variable |
|
505 SET correct_substring= |
|
506 |
|
507 REM =========================================================================================== |
|
508 REM Checking string's end to contain either backslash and double quotes or just double quotes = |
|
509 REM =========================================================================================== |
|
510 REM Checking image variables |
|
511 IF !stx.stx_bin_dir:~-2! NEQ \^" ( |
|
512 SET __numeric.exit_value=1 |
|
513 SET "message="Incorrect configuration detected. Missing backslash at variable stx.stx_bin_dir: - !stx.stx_bin_dir! -"" |
|
514 CALL :exit_sequence !message! |
|
515 GOTO :EOF |
|
516 ) |
|
517 |
|
518 REM Checking image variables |
|
519 IF !stx.image_path:~-2! NEQ \^" ( |
|
520 SET __numeric.exit_value=1 |
|
521 SET "message="Incorrect configuration detected. Missing backslash at variable stx.image_path: - !stx.image_path! -"" |
|
522 CALL :exit_sequence !message! |
|
523 GOTO :EOF |
|
524 ) |
|
525 IF !stx.image_name:~-1! NEQ ^" ( |
|
526 SET __numeric.exit_value=1 |
|
527 SET "message="Incorrect configuration detected missing double quotes at stx.image_name variable: - !stx.image_name! -"" |
|
528 CALL :exit_sequence !message! |
|
529 GOTO :EOF |
|
530 ) |
|
531 IF !stx.image_suffix:~-1! NEQ ^" ( |
|
532 SET __numeric.exit_value=1 |
|
533 SET "message="Incorrect configuration detected missing double quotes at stx.image_suffix variable: - !stx.image_suffix! -"" |
|
534 CALL :exit_sequence !message! |
|
535 GOTO :EOF |
|
536 ) |
|
537 |
|
538 REM Checking logging variables |
|
539 IF !stx.log_directory:~-2! NEQ \^" ( |
|
540 SET __numeric.exit_value=1 |
|
541 SET "message="Incorrect configuration detected. Missing backslash at variable stx.log_directory: - !stx.log_directory! -"" |
|
542 CALL :exit_sequence !message! |
|
543 GOTO :EOF |
|
544 ) |
|
545 IF !stx.log_name:~-1! NEQ ^" ( |
|
546 SET __numeric.exit_value=1 |
|
547 SET "message="Incorrect configuration detected missing double quotes at stx.log_name variable: - !stx.log_name! -"" |
|
548 CALL :exit_sequence !message! |
|
549 GOTO :EOF |
|
550 ) |
|
551 IF !stx.log_suffix:~-1! NEQ ^" ( |
|
552 SET __numeric.exit_value=1 |
|
553 SET "message="Incorrect configuration detected missing double quotes at stx.log_suffix variable: - !stx.log_suffix! -"" |
|
554 CALL :exit_sequence !message! |
|
555 GOTO :EOF |
|
556 ) |
|
557 IF !log_filename:~-1! NEQ ^" ( |
|
558 SET __numeric.exit_value=1 |
|
559 SET "message="Incorrect configuration detected missing double quotes at log_filename variable: - !log_filename! -"" |
|
560 CALL :exit_sequence !message! |
|
561 GOTO :EOF |
|
562 ) |
|
563 REM must be used (inside IF^^!) |
|
564 REM =========================================== |
|
565 REM Print validation message if user wants to = |
|
566 REM =========================================== |
442 IF "!stx.verify_print_message!" EQU "TRUE" ( |
567 IF "!stx.verify_print_message!" EQU "TRUE" ( |
443 CALL :print_message !use_color! !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "===============================" "Variable syntax validated. =" "===============================" |
568 CALL :print_message !use_color! !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "===============================" "Variable syntax validated. =" "===============================" |
444 ECHO: |
569 ECHO: |
445 ) |
570 ) |
446 ) |
571 ) |
526 :: change the line below, if the support stuff is not found in the |
651 :: change the line below, if the support stuff is not found in the |
527 :: directory where stx-bin.com / stx.com resides. (exe is for GUI only) |
652 :: directory where stx-bin.com / stx.com resides. (exe is for GUI only) |
528 :: STX_LIB_DIR=<path_to_support_files> |
653 :: STX_LIB_DIR=<path_to_support_files> |
529 |
654 |
530 :: Change to the specified bin directory |
655 :: Change to the specified bin directory |
531 pushd "!stx_bin_dir!" |
656 pushd "!stx.stx_bin_dir!" |
532 IF EXIST "stx-bin.com" ( |
657 IF EXIST "stx-bin.com" ( |
533 IF "!stx.__binary.run_via_shell!" EQU "TRUE" ( |
658 IF "!stx.__binary.run_via_shell!" EQU "TRUE" ( |
534 SET "selected_executable=stx-bin.com" |
659 SET "selected_executable=stx-bin.com" |
535 ) ELSE ( |
660 ) ELSE ( |
536 SET "selected_executable=stx-bin.exe" |
661 SET "selected_executable=stx-bin.exe" |
537 ) |
662 ) |
538 SET "stx_home=!stx_bin_dir:"=!.." |
663 SET "stx_home=!stx.stx_bin_dir:"=!.." |
539 SET "stx_topdir=!stx_bin_dir:"=!..\lib\smalltalkx\!stx_version!" |
664 SET "stx_topdir=!stx.stx_bin_dir:"=!..\lib\smalltalkx\!stx_version!" |
540 SET "stx_libdir=!stx_bin_dir:"=!..\lib\smalltalkx\!stx_version!\lib" |
665 SET "stx_libdir=!stx.stx_bin_dir:"=!..\lib\smalltalkx\!stx_version!\lib" |
541 SET "smalltalk_executable=!stx_bin_dir:"=!!selected_executable!" |
666 SET "smalltalk_executable=!stx.stx_bin_dir:"=!!selected_executable!" |
542 ) ELSE IF EXIST "stx.com" ( |
667 ) ELSE IF EXIST "stx.com" ( |
543 IF "!stx.__binary.run_via_shell!" EQU "TRUE" ( |
668 IF "!stx.__binary.run_via_shell!" EQU "TRUE" ( |
544 SET "selected_executable=stx.com" |
669 SET "selected_executable=stx.com" |
545 ) ELSE ( |
670 ) ELSE ( |
546 SET "selected_executable=stx.exe" |
671 SET "selected_executable=stx.exe" |
547 ) |
672 ) |
548 SET smalltalk_executable="!stx_bin_dir:"=!!selected_executable!" |
673 SET smalltalk_executable="!stx.stx_bin_dir:"=!!selected_executable!" |
549 ) ELSE ( |
674 ) ELSE ( |
550 |
675 |
551 SET "message="The executable stx-bin^.com;exe perhaps stx^.com;exe NOT found."" |
676 SET "message="The executable stx-bin^.com;exe perhaps stx^.com;exe NOT found."" |
552 SET __numeric.exit_value=1 |
677 SET __numeric.exit_value=1 |
553 CALL :exit_sequence !message! |
678 CALL :exit_sequence !message! |