smalltalk.bat
author Patrik Svestka <patrik.svestka@gmail.com>
Wed, 10 Jan 2018 14:37:22 +0100
branchjv
changeset 1537 c9aea063a34e
parent 1527 c882cd8db4f7
child 1539 f31be43f0fa7
permissions -rwxr-xr-x
Issue: #172 StX fails to start on Windows when launcher script is run from different directory Win32 launcher version: 1.5.1 The patch addresses missing configuration path. Only the configuration file (*.cfg) was talken without any path. Worked as the smalltalk.bat is in the same directory, but if executed outside the directory it stopped working.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
     1
@ECHO OFF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
     2
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
     3
::  _____                 _ _ _        _ _         ____   __               
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
     4
:: /  ___|               | | | |      | | |       / /\ \ / /               
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
     5
:: \ `--. _ __ ___   __ _| | | |_ __ _| | | __   / /  \ V /                
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
     6
::  `--. \ '_ ` _ \ / _` | | | __/ _` | | |/ /  / /   /   \                
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
     7
:: /\__/ / | | | | | (_| | | | || (_| | |   <  / /   / /^\ \               
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
     8
:: \____/|_| |_| |_|\__,_|_|_|\__\__,_|_|_|\_\/_/    \/   \/               
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
     9
::                                                                         
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
    10
::  _    _ _                  _                            _               
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
    11
:: | |  | (_)                | |                          | |              
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
    12
:: | |  | |_ _ __    ______  | |     __ _ _   _ _ __   ___| |__   ___ _ __ 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    13
:: | |/\| | | '_ \  |______| | |    / _` | | | | '_ \ / __| '_ \ / _ \ '__|
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
    14
:: \  /\  / | | | |          | |___| (_| | |_| | | | | (__| | | |  __/ |   
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    15
::  \/  \/|_|_| |_|          \_____/\__,_|\__,_|_| |_|\___|_| |_|\___|_|
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    16
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    17
:: ==================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    18
:: The startup script for smalltalk =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    19
:: ==================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    20
:: This script is vastly improved previous smalltalk.bat.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    21
:: In previous versions, smalltalk used to be the executable itself.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    22
:: This lead to problems on systems, where things like the PATH or STX_LIBDIR should be set in advance.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    23
:: Now, here is a place to do such things ...
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    24
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    25
:: ==========
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    26
:: Contents =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    27
:: ==========
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    28
:: Every section is separated by these words: Next section follows =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    29
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    30
:: 1 - Versions; batch files switches; setting on ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    31
:: 2 - Configuration
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    32
:: 3 - PowerShell detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    33
:: 4 - Timer section
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    34
:: 5 - Adjusting according to the configuration
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    35
:: 6 - Checking variable and logic consistency
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    36
:: 7 - Verify existence of paths and files from configuration
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    37
:: 8 - A work-flow based on the configuration
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    38
:: 9 - Running the command
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    39
:: 10 - User defined functions
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    40
:: 11 - Support information (like help, about, version)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    41
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    42
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    43
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
    44
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    45
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    46
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    47
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    48
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    49
:: Beginning                                                                                 *
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    50
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    51
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    52
:: ==========
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    53
:: Versions =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    54
:: ==========
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    55
:: This script
1520
14d8a421b84c Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1518
diff changeset
    56
SET batch_script_version=1.5.1
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    57
:: Smalltalk/X
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
    58
SET stx_version=6.2.6
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    59
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    60
:: ====================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    61
:: Comments and style =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    62
:: ====================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    63
:: USING :: instead of REM is a hack for now supported and it makes the bat execution much faster
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    64
:: The reason is: REM is a command that has to be processed by cmd.exe, but the :: is a sign followed
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    65
:: by :.  The first : makes the interpreter ignore the line altogether.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    66
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    67
:: If Microsoft should drop support of :: hack. Change you have to change all :: back to REM
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    68
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    69
:: =========================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    70
:: Batch file accepts following parameters =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    71
:: =========================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    72
:: Enclosing the input parameter with double quotes is a correct way how to do it
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    73
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    74
IF "%~1" EQU "--help" ECHO: & ECHO "stx.com help, for the laucher use --help-launcher." & ECHO: & GOTO stx_help
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    75
IF "%~1" EQU "-h" ECHO: & ECHO "stx.com help, for the laucher use --help-launcher." & ECHO: & GOTO stx_help
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    76
IF "%~1" EQU "/h" ECHO: & ECHO "stx.com help, for the laucher use --help-launcher." & GOTO stx_help
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    77
IF "%~1" EQU "/?" ECHO: & ECHO "stx.com help, for the laucher use --help-launcher." & GOTO stx_help
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    78
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    79
IF "%~1" EQU "--help-launcher" ECHO: & GOTO stx_help_launcher
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    80
IF "%~1" EQU "-h-l" ECHO: & GOTO stx_help_launcher
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    81
IF "%~1" EQU "/h-l" ECHO: & GOTO stx_help_launcher
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    82
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    83
IF "%~1" EQU "--about" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    84
    ECHO: & CALL :stx_about %batch_script_version% %stx_version%
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    85
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    86
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    87
IF "%~1" EQU "-a" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    88
    ECHO: & CALL :stx_about %batch_script_version% %stx_version%
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    89
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    90
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    91
IF "%~1" EQU "/a" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    92
    ECHO: & CALL :stx_about %batch_script_version% %stx_version%
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    93
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    94
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    95
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    96
IF "%~1" EQU "--version" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    97
    ECHO: & CALL :stx_version %batch_script_version% %stx_version%
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    98
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
    99
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   100
IF "%~1" EQU "-v" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   101
    ECHO: & CALL :stx_version %batch_script_version% %stx_version%
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   102
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   103
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   104
IF "%~1" EQU "/v" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   105
    ECHO: & CALL :stx_version %batch_script_version% %stx_version%
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   106
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   107
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   108
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   109
:: ==================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   110
:: Batch file flags =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   111
:: ==================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   112
:: Here for the correct deletion of the filled variables when script finishes
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   113
:: ENABLEEXTENSIONS - enable or disable command processor extensions. These
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   114
:: arguments takes precedence over the CMD /E:ON or /E:OFF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   115
:: ENABLEDELAYEDEXPANSION - enable or disable delayed environment variable
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   116
:: expansion. These arguments takes precedence over the CMD /V:ON or /V:OFF switches.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   117
VERIFY OTHER 2>nul
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   118
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   119
IF ERRORLEVEL 1 (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   120
    REM No color as expansion is not yet enabled
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   121
    ECHO "Unable to enable extensions.  Fix it."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   122
    SET exit_value=1
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   123
    GOTO exit_sequence 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   124
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   125
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   126
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   127
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   128
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   129
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   130
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   131
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   132
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   133
:: Configuration                                                                             *
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   134
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   135
:: Now all the variables except the for configuration file are in the configuration file.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   136
:: For more see variable configuration_file_path
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   137
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   138
:: ==================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   139
:: Clearing the shell prior the run =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   140
:: ==================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   141
::CLS
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   142
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   143
:: ===========================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   144
:: Reading variables from external .cfg file =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   145
:: ===========================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   146
:: The only variable that can not be validated (be careful when changing it^!)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   147
:: The reason is that it is before the validation process
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   148
SET "configuration_file_path=%~dp0"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   149
SET "configuration_file=smalltalk.cfg"
1520
14d8a421b84c Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1518
diff changeset
   150
SET "configuration_file_with_path=!configuration_file_path!!configuration_file!"
14d8a421b84c Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1518
diff changeset
   151
IF NOT EXIST !configuration_file_with_path! (
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   152
    SET "message="Smalltalk configuration file: !configuration_file! not found. Fix it.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   153
    SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   154
    CALL :exit_sequence !message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   155
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   156
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   157
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   158
:: EOL stops comments from being parsed
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   159
:: otherwise split lines at the = char into two tokens
1520
14d8a421b84c Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1518
diff changeset
   160
FOR /F "EOL=# delims== tokens=1,*" %%A IN (!configuration_file_with_path!) DO (
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   161
    REM proper lines have both a and b set
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   162
    REM if okay, assign property to some kind of namespace
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   163
    REM so some.property becomes test.some.property in batch-land
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   164
    IF NOT "%%A"=="" IF NOT "%%B"=="" SET stx.%%A=%%B
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   165
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   166
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   167
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   168
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   169
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   170
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   171
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   172
:: =============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   173
:: Start timer =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   174
:: =============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   175
IF "!stx.__binary.use_timer!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   176
    CALL :time_in_seconds __start
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   177
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   178
    ECHO "[INFO] Start timer. START at: !__start! [seconds]"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   179
    ECHO:
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   180
    
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   181
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   182
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   183
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   184
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   185
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   186
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   187
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   188
:: To see stx. namespace uncomment below
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   189
:: SET stx.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   190
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   191
:: =================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   192
:: Expanding variables from the configuration file =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   193
:: =================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   194
:: Variable needs expanding if shell pseudo-variable is used e.g. ...dp0
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   195
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   196
:: ===================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   197
:: Stx bin directory =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   198
:: ===================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   199
IF "!stx.stx_bin_dir!" NEQ "" (
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   200
    CALL :expand_path !stx.stx_bin_dir! stx.stx_bin_dir
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   201
    IF ERRORLEVEL 1 (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   202
        ECHO "[ERROR] -> stx.stx_bin_dir <- variable error in  check your configuration file -> !stx.stx_bin_dir! <-"
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   203
        GOTO :EOF 
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   204
    )
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   205
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   206
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   207
:: ===================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   208
:: Stx quick start and image details =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   209
:: ===================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   210
IF "!stx.image_path!" NEQ "" (
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   211
    CALL :expand_path !stx.image_path! stx.image_path
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   212
    IF ERRORLEVEL 1 (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   213
        ECHO "[ERROR] -> stx.image_path <- variable error in  check your configuration file -> !stx.image_path! <-"
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   214
        GOTO :EOF 
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   215
    )
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   216
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   217
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   218
:: =============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   219
:: Stx logging =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   220
:: =============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   221
IF "!stx.log_directory!" NEQ "" (
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   222
    CALL :expand_path !stx.log_directory! stx.log_directory
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   223
    IF ERRORLEVEL 1 (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   224
        ECHO "[ERROR] -> stx.log_directory <- variable error in  check your configuration file -> !stx.log_directory! <-"
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   225
        GOTO :EOF 
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   226
    )
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   227
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   228
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   229
:: ==================================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   230
:: Script's internal variables                                                      =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   231
:: WARNING: DO NOT TOUCH THE SET VALUES BELOW UNLESS YOU KNOW WHAT YOU ARE DOING!!! =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   232
:: ==================================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   233
:: minimal powershell version, otherwise fall-back is triggered
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   234
:: The path for powershell contains v1.0 for all powershell versions!!!!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   235
SET minimal_powershell_version=2.0
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   236
:: this variable is directly accessed also in powershell file
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   237
SET "powershell_version_all_functionality=3.0"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   238
SET PowerShellVersion=""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   239
SET RuntimeVersion=""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   240
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   241
:: Setting powershell script path and filename
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   242
SET "powershell_script_path=%~dp0"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   243
SET "powershell_file=smalltalk.ps1"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   244
SET "powershell_script_file=!powershell_script_path!!powershell_file!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   245
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   246
:: Fallback option must be always active
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   247
SET "__binary.powershell_detected=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   248
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   249
:: Default value is not to use stx command-line switches
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   250
SET "stx_manual_switch_detected=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   251
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   252
:: default script exit value ^(^=0 - everything OK, ^<^>0 - not OK^)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   253
SET __numeric.exit_value=0
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   254
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   255
:: Make sure variable is undefined
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   256
SET internal_runtime_options=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   257
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   258
:: Used for switches enter by user at command-line,
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   259
:: making sure variable is undefined at the beginning
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   260
:: This variable is accessed directly from powershell file
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   261
SET stx_switch=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   262
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   263
:: Make sure variable is undefined
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   264
SET stx_date_time=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   265
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   266
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   267
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   268
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   269
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   270
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   271
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   272
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   273
:: PowerShell detection                                                                      *
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   274
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   275
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   276
:: =============================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   277
:: Calling user function :powershell_detection =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   278
:: =============================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   279
CALL :powershell_detection __binary.powershell_detected PowerShellVersion RuntimeVersion
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   280
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   281
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   282
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   283
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   284
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   285
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   286
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   287
:: Adjusting according to the configuration                                                  *
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   288
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   289
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   290
:: =============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   291
:: Shell Color =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   292
:: =============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   293
IF "!stx.__binary.colored_stdout!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   294
    IF "!__binary.powershell_detected!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   295
        SET "use_color=TRUE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   296
    ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   297
        SET "use_color=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   298
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   299
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   300
    SET "use_color=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   301
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   302
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   303
:: ============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   304
:: Image name =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   305
:: ============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   306
SET default_image_name="!stx.image_name:"=!!stx.image_suffix:"=!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   307
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   308
:: ============================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   309
:: Add encoding to the suffix =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   310
:: ============================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   311
:: Allowed values ASCII, UTF8 (default), UTF16 (in Microsoft world that is called Unicode), UTF32
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   312
:: 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
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   313
IF "!stx.log_file_encoding!" EQU "ASCII" (
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   314
    SET "stx.log_suffix="_ascii!stx.log_suffix:"=!""
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   315
) ELSE IF "!stx.log_file_encoding!" EQU "UTF8" (
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   316
    SET "stx.log_suffix="_utf8!stx.log_suffix:"=!""
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   317
) ELSE IF "!stx.log_file_encoding!" EQU "UTF16" (
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   318
    SET "stx.log_suffix="_utf16!stx.log_suffix:"=!""
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   319
) ELSE IF "!stx.log_file_encoding!" EQU "UTF32" (
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   320
    SET "stx.log_suffix="_utf32!stx.log_suffix:"=!""
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   321
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   322
    SET "message="Invalid log file encoding: !stx.log_file_encoding!. Fix it and run the script again.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   323
    SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   324
    CALL :exit_sequence !message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   325
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   326
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   327
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   328
:: =================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   329
:: UTF16 alias Microsoft's Unicode name conversion =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   330
:: =================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   331
IF "!stx.log_file_encoding!" EQU "UTF16" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   332
    SET stx.log_file_encoding=Unicode
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   333
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   334
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   335
:: =================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   336
:: Log file format =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   337
:: =================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   338
:: Using wmic os get as it is probably the only locales independent way to get time on Windows
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   339
:: Date: Using date ISO 8601 format YYYY-MM-DD with time part
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   340
:: Time: Using time and date format independent of locales
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   341
:: Note: back ticks are there for powershell compatibility
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   342
IF "!stx.__binary.log_add_datepart!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   343
    FOR /F %%A IN ('wmic os get LocalDateTime ^| find "."') DO SET dts=%%A
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   344
    SET stx_date_time=!dts:~0,4!-!dts:~4,2!-!dts:~6,2!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   345
    IF "!stx.__binary.log_add_timepart!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   346
        SET stx_date_time=!stx_date_time!_!dts:~8,2!"`;"!dts:~10,2!"`;"!dts:~12,2!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   347
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   348
    SET log_filename="!stx.log_name:"=!_!stx_date_time!!stx.log_suffix:"=!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   349
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   350
    FOR /F %%A IN ('wmic os get LocalDateTime ^| find "."') DO SET dts=%%A
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   351
    IF "!stx.__binary.log_add_timepart!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   352
        SET stx_date_time=!dts:~8,2!"`;"!dts:~10,2!"`;"!dts:~12,2!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   353
        SET log_filename="!stx.log_name:"=!_!stx_date_time!!stx.log_suffix:"=!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   354
    ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   355
        SET log_filename="!stx.log_name:"=!!stx.log_suffix:"=!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   356
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   357
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   358
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   359
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   360
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   361
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   362
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   363
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   364
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   365
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   366
:: Checking variable and logic consistency                                                   *
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   367
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   368
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   369
:: ==============================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   370
:: Checking the PowerShell file (.ps1) presence =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   371
:: ==============================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   372
IF NOT EXIST "!powershell_script_file!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   373
    SET "message="PowerShell file missing: !powershell_script_path!smalltalk.ps1.  Fix it.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   374
    SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   375
    CALL :exit_sequence !message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   376
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   377
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   378
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   379
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   380
:: =======================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   381
:: Variables' validation =
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   382
:: =======================
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   383
IF "!stx.verify_variables_syntax!" EQU "TRUE" (
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   384
    REM must be used (inside IF^^!)
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   385
    REM =====================================================================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   386
    REM Validate __binary for TRUE^/FALSE and if it does not contain spaces =
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   387
    REM =====================================================================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   388
    REM Checks if the variable contains correctly written TRUE^/FALSE
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   389
    REM additionally it also checks if additional space was not added by mistake
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   390
    REM var -7 extracts the last 7 characters from var
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   391
    FOR /F "tokens=3 delims=^." %%A IN ('SET stx.__binary.') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   392
        SET temp_test=%%A
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   393
        IF "!temp_test:~-5!" EQU "=TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   394
            IF "!temp_test!" NEQ "!temp_test: =!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   395
                SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   396
                SET "first_message="Incorrect configuration additional space detected.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   397
                SET "first_message="Correct the variable: __binary.!temp_test!""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   398
                CALL :exit_sequence !first_message! !second_message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   399
                GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   400
            )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   401
        ) ELSE IF "!temp_test:~-6!" EQU "=FALSE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   402
            IF "!temp_test!" NEQ "!temp_test: =!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   403
                SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   404
                SET "first_message="Incorrect configuration additional space detected.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   405
                SET "second_message="Correct the variable: __binary.!temp_test!""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   406
                CALL :exit_sequence !first_message! !second_message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   407
                GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   408
            )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   409
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   410
            IF "!temp_test!" NEQ "!temp_test: =!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   411
                SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   412
                SET "first_message="Incorrect configuration additional space detected.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   413
                SET "second_message="Correct the variable: __binary.!temp_test!""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   414
                CALL :exit_sequence !first_message! !second_message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   415
                GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   416
            ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   417
                SET "first_message="Incorrect configuration mistake in TRUE^/FALSE detected.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   418
                SET "second_message="Correct the variable: __binary.!temp_test!""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   419
                SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   420
                CALL :exit_sequence !first_message! !second_message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   421
                GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   422
            )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   423
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   424
    )
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
   425
    REM must be used (inside IF^^!)
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   426
    REM  ===================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   427
    REM  Validate if __binary values are numeric and do not contain spaces =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   428
    REM  ===================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   429
    REM 1. FOR - variable extraction bla value
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   430
    REM 2. FOR - extracting integer value
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   431
    REM 3. FOR - testing integer
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   432
    FOR /F "tokens=3 delims=^." %%A IN ('SET stx.__numeric.') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   433
        SET temp_test=%%A
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   434
        FOR /F "tokens=2 delims==" %%B IN ("!temp_test!") DO SET "test_integer=%%B"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   435
        SET "ugh="&FOR /F "delims=0123456789" %%C IN ("!test_integer!") DO SET "ugh=%%~C"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   436
        IF defined ugh (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   437
            IF "!temp_test!" NEQ "!temp_test: =!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   438
                SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   439
                SET "first_message="Incorrect configuration additional space detected.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   440
                SET "second_message="Correct the variable: __binary.!temp_test!""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   441
                CALL :exit_sequence !first_message! !second_message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   442
                GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   443
            ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   444
                SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   445
                SET "message="Incorrect configuration detected - integer value is not an integer.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   446
                CALL :exit_sequence !message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   447
                GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   448
            )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   449
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   450
              IF "!temp_test!" NEQ "!temp_test: =!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   451
                  SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   452
                  SET "first_message="Incorrect configuration additional space detected.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   453
                  SET "second_message="Correct the variable: __binary.!temp_test!""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   454
                  CALL :exit_sequence !first_message! !second_message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   455
                  GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   456
              )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   457
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   458
    )
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   459
    REM must be used (inside IF^^!)
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   460
    REM ===============================================================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   461
    REM Validate path variables to contain double quotes or backslash =
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   462
    REM ===============================================================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   463
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   464
    REM ========================================================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   465
    REM Check beginning of the string to contain double quotes =
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   466
    REM ========================================================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   467
    REM Checking image variables
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   468
    SET "correct_substring=!stx.image_name:~0,1!"
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   469
    IF !correct_substring! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   470
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   471
        SET "message="Incorrect configuration detected missing double quotes at stx.image_name variable: - !stx.image_name! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   472
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   473
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   474
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   475
    SET "correct_substring=!stx.image_suffix:~0,1!"
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   476
    IF !correct_substring! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   477
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   478
        SET "message="Incorrect configuration detected missing double quotes at stx.image_suffix variable: - !stx.image_suffix! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   479
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   480
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   481
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   482
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   483
    REM Checking logging variables
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   484
    SET "correct_substring=!stx.log_name:~0,1!"
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   485
    IF !correct_substring! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   486
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   487
        SET "message="Incorrect configuration detected missing double quotes at stx.log_name variable: - !stx.log_name! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   488
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   489
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   490
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   491
    SET "correct_substring=!stx.log_suffix:~0,1!"
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   492
    IF !correct_substring! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   493
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   494
        SET "message="Incorrect configuration detected missing double quotes at stx.log_suffix variable: - !stx.log_suffix! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   495
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   496
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   497
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   498
    SET "correct_substring=!log_filename:~0,1!"
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   499
    IF !correct_substring! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   500
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   501
        SET "message="Incorrect configuration detected missing double quotes at log_filename variable: - !log_filename! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   502
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   503
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   504
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   505
    REM clearing temp variable
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   506
    SET correct_substring=
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   507
    
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   508
    REM ===========================================================================================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   509
    REM Checking string's end to contain either backslash and double quotes or just double quotes =
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   510
    REM ===========================================================================================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   511
    REM Checking image variables
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   512
    IF !stx.stx_bin_dir:~-2! NEQ \^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   513
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   514
        SET "message="Incorrect configuration detected.  Missing backslash at variable stx.stx_bin_dir: - !stx.stx_bin_dir! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   515
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   516
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   517
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   518
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   519
    REM Checking image variables
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   520
    IF !stx.image_path:~-2! NEQ \^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   521
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   522
        SET "message="Incorrect configuration detected.  Missing backslash at variable stx.image_path: - !stx.image_path! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   523
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   524
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   525
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   526
    IF !stx.image_name:~-1! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   527
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   528
        SET "message="Incorrect configuration detected missing double quotes at stx.image_name variable: - !stx.image_name! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   529
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   530
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   531
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   532
    IF !stx.image_suffix:~-1! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   533
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   534
        SET "message="Incorrect configuration detected missing double quotes at stx.image_suffix variable: - !stx.image_suffix! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   535
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   536
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   537
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   538
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   539
    REM Checking logging variables
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   540
    IF !stx.log_directory:~-2! NEQ \^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   541
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   542
        SET "message="Incorrect configuration detected.  Missing backslash at variable stx.log_directory: - !stx.log_directory! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   543
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   544
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   545
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   546
    IF !stx.log_name:~-1! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   547
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   548
        SET "message="Incorrect configuration detected missing double quotes at stx.log_name variable: - !stx.log_name! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   549
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   550
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   551
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   552
    IF !stx.log_suffix:~-1! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   553
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   554
        SET "message="Incorrect configuration detected missing double quotes at stx.log_suffix variable: - !stx.log_suffix! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   555
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   556
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   557
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   558
    IF !log_filename:~-1! NEQ ^" (
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   559
        SET __numeric.exit_value=1
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   560
        SET "message="Incorrect configuration detected missing double quotes at log_filename variable: - !log_filename! -""
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   561
        CALL :exit_sequence !message!
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   562
        GOTO :EOF
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   563
    )
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   564
    REM must be used (inside IF^^!)
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   565
    REM ===========================================
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   566
    REM Print validation message if user wants to =
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   567
    REM ===========================================
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   568
    IF "!stx.verify_print_message!" EQU "TRUE" (
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   569
        CALL :print_message !use_color! !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "===============================" "Variable syntax validated.    =" "==============================="
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   570
        ECHO:
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   571
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   572
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   573
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   574
:: =============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   575
:: Quick start =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   576
:: =============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   577
:: Note: quick start should not be used with image functionality
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   578
:: If there is a mistake in image functionality (start_with_image=FALSE and list_available_images=TRUE)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   579
:: THEN quick start is used
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   580
IF "!stx.__binary.stx_quick_start!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   581
    IF "!stx.__binary.start_with_image!" EQU "TRUE" (
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
   582
        CALL :print_message !use_color! !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] Your configuration flawed - compensating." "[WARN] stx_quick_start=TRUE AND start_with_image=TRUE which makes no sense."
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   583
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   584
        SET "stx.__binary.stx_quick_start=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   585
    ) ELSE IF "!stx.__binary.list_available_images!" EQU "TRUE" (
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   586
        CALL :print_message !use_color! !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] Your configuration flawed - compensating." "[WARN] start_with_image=FALSE, list_available_images=TRUE, AND stx_quick_start=TRUE which makes no sense." "[WARN] Using only stx_quick_start=TRUE"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   587
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   588
        SET "stx.__binary.list_available_images=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   589
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   590
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   591
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   592
:: ==========================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   593
:: Pair stx.__binary.start_with_image ^& stx.__binary.list_available_images =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   594
:: ==========================================================================
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   595
:: NOTE: not using :print_message -> sending too many messages
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   596
IF "!stx.__binary.start_with_image!" EQU "FALSE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   597
    IF "!stx.__binary.list_available_images!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   598
        IF "!use_color!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   599
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] Your configuration flawed - compensating."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   600
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] start_with_image=FALSE AND list_available_images=TRUE which makes no sense."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   601
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] Setting list_available_images=FALSE."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   602
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] To fix it either set start_with_image=TRUE or list_available_images=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   603
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   604
            ECHO "[WARN] Your configuration flawed - compensating."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   605
            ECHO "[WARN] start_with_image=FALSE AND list_available_images=TRUE which makes no sense."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   606
            ECHO "[WARN] Setting list_available_images=FALSE."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   607
            ECHO "[WARN] To fix it either set start_with_image=TRUE or list_available_images=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   608
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   609
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   610
        SET "stx.__binary.list_available_images=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   611
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   612
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   613
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   614
:: ============================================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   615
:: Pair variables (work together) stx.__binary.record_log_file and stx.__binary.append_to_log =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   616
:: ============================================================================================
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   617
:: NOTE: not using :print_message -> sending too many messages
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   618
IF "!stx.__binary.record_log_file!" EQU "FALSE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   619
    IF "!stx.__binary.append_to_log!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   620
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   621
        IF "!use_color!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   622
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] Your configuration flawed - compensating."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   623
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] record_log_file=FALSE AND append_to_log=TRUE which makes no sense."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   624
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] Setting append_to_log=FALSE."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   625
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] To fix it either set record_log_file=TRUE or append_to_log=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   626
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   627
            ECHO "[WARN] Your configuration flawed - compensating."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   628
            ECHO "[WARN] record_log_file=FALSE AND append_to_log=TRUE which makes no sense."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   629
            ECHO "[WARN] Setting append_to_log=FALSE."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   630
            ECHO "[WARN] To fix it either set record_log_file=TRUE or append_to_log=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   631
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   632
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   633
        SET "stx.__binary.append_to_log=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   634
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   635
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   636
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   637
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   638
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   639
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   640
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   641
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   642
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   643
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   644
:: Verify existence of paths and files from configuration                                    *
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   645
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   646
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   647
:: ===================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   648
:: Selecting an executable                           =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   649
:: Checking for a presence of %smalltalk_executable% =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   650
:: ===================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   651
:: Your path to smalltalk & and exec (bat,cmd,com,exe, etc.)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   652
:: change the line below, if the support stuff is not found in the
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   653
:: directory where stx-bin.com / stx.com resides.  (exe is for GUI only)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   654
:: STX_LIB_DIR=<path_to_support_files>
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   655
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   656
:: Change to the specified bin directory
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   657
pushd "!stx.stx_bin_dir!"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   658
IF EXIST "stx-bin.com" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   659
    IF "!stx.__binary.run_via_shell!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   660
        SET "selected_executable=stx-bin.com"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   661
     ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   662
        SET "selected_executable=stx-bin.exe"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   663
     )
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   664
    SET "stx_home=!stx.stx_bin_dir:"=!.."
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   665
    SET "stx_topdir=!stx.stx_bin_dir:"=!..\lib\smalltalkx\!stx_version!"
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   666
    SET "stx_libdir=!stx.stx_bin_dir:"=!..\lib\smalltalkx\!stx_version!\lib"
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   667
    SET "smalltalk_executable=!stx.stx_bin_dir:"=!!selected_executable!"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   668
) ELSE IF EXIST "stx.com" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   669
     IF "!stx.__binary.run_via_shell!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   670
        SET "selected_executable=stx.com"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   671
     ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   672
        SET "selected_executable=stx.exe"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   673
     )
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
   674
    SET smalltalk_executable="!stx.stx_bin_dir:"=!!selected_executable!"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   675
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   676
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   677
    SET "message="The executable stx-bin^.com;exe perhaps stx^.com;exe NOT found.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   678
    SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   679
    CALL :exit_sequence !message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   680
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   681
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   682
:: return back
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   683
popd
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   684
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   685
:: ==========================================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   686
:: Checking if the image at the path really exists.                                         =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   687
:: using temporary variable due to the fact that NOT exists needs already expanded variable =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   688
:: ==========================================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   689
SET "temp_stx.image_path=!stx.image_path:"=!!default_image_name:"=!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   690
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   691
IF "!stx.__binary.start_with_image!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   692
    IF "!stx.__binary.list_available_images!" EQU "FALSE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   693
        IF NOT EXIST "!temp_stx.image_path!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   694
            REM TOO DEEP MUST FIX
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   695
            REM CALL :colorEcho stx.stdout_cmd_warning "[WARN] The default image: !stx.image_path:"=!!default_image_name:"=! was not found."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   696
            REM CALL :colorEcho stx.stdout_cmd_warning "[WARN] No image will loaded. If you want to load from image fix your path or image name."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   697
            ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   698
            SET "stx.__binary.start_with_image=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   699
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   700
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   701
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   702
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   703
:: clearing temp variable
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   704
SET temp_stx.image_path=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   705
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   706
:: ===============================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   707
:: Checking existence of logging directory, if not found all logging is disabled =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   708
:: ===============================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   709
IF NOT EXIST "!stx.log_directory!" (
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   710
    CALL :print_message !use_color! !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] The logging path: !stx.log_directory! NOT found." "[WARN] Logging will be DISABLED."
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   711
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   712
    SET stx.__binary.start_with_image=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   713
    SET stx.__binary.append_to_log=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   714
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   715
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   716
:: ================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   717
:: Checking existence of log file if not found append is disabled =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   718
:: ================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   719
IF NOT EXIST "!log_filename!" (
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   720
    CALL :print_message !use_color! !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "[INFO] No log file found turning off the append mode."
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   721
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   722
    SET stx.__binary.append_to_log=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   723
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   724
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   725
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   726
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   727
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   728
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   729
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   730
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   731
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   732
:: A work-flow based on the configuration                                                    *
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   733
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   734
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   735
:: =================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   736
:: If powershell detected, get powershell executable from registry =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   737
:: =================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   738
:: FINDSTR is there for Windows XP compatibility
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   739
IF "!__binary.powershell_detected!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   740
    (FOR /F "tokens=3" %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" /v path ^| FINDSTR "^.*\.exe$"') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   741
         SET "powershell_exec=%%A"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   742
    )) || REM
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   743
    IF ERRORLEVEL 1 (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   744
        SET "first_message="[ERROR] Powershell detected, but executable !powershell_exec! not found.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   745
        SET "second_message="Fix your system.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   746
        SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   747
        CALL :exit_sequence !first_message! !second_message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   748
        GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   749
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   750
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   751
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   752
:: ===================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   753
:: Powershell detected? (so we can log into a file?) =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   754
:: ===================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   755
IF "!stx.__binary.record_log_file!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   756
    IF "!__binary.powershell_detected!" EQU "FALSE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   757
        SET "stx.__binary.record_log_file=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   758
        SET "stx.__binary.append_to_log=FALSE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   759
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   760
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   761
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   762
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   763
:: =====================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   764
:: Adding all parameters available to the %stx_switch% =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   765
:: Making sure previous switches are taken in account  =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   766
:: =====================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   767
:: Cycle all command-line switches entered in the shell by the user
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   768
:: Encircle all switches (both - and --) by double-quotes
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   769
:: Ignore the command-line switches already with double quotes
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   770
:: Replace single quotes with double quotes if such switch is found
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   771
IF "%~1" NEQ "" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   772
    SET "stx_manual_switch_detected=TRUE"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   773
    SET "detect_double_switch=--"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   774
    SET "detect_single_switch=-"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   775
    SET "detect_double_quote="-"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   776
    SET "detect_single_quote='-"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   777
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   778
    FOR %%A IN (%*) DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   779
        SET "temp_string=%%~A"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   780
        IF DEFINED stx_switch (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   781
            REM Detect if "" around a switch are used and leave the switch alone
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   782
            IF "!temp_string:~0,2!" EQU "!detect_double_quote!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   783
                SET stx_switch=!stx_switch! %%A
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   784
            REM Detect if '' around a switch are used and convert them to ""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   785
            ) ELSE IF "!temp_string:~0,2!" EQU "!detect_single_quote!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   786
                SET "changed_string=!temp_string:'="!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   787
                SET stx_switch=!stx_switch! !changed_string!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   788
            REM if -- found encircle it with double quotes
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   789
            ) ELSE IF "!temp_string:~0,2!" EQU "!detect_double_switch!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   790
                SET stx_switch=!stx_switch! ^"%%~A^"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   791
            REM checks a string for "-" if it contains it it will add double-quotes
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   792
            ) ELSE IF "!temp_string:~0,1!" EQU "!detect_single_switch!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   793
                SET stx_switch=!stx_switch! ^"%%~A^"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   794
            ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   795
                SET "stx_switch=!stx_switch! %%A"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   796
            )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   797
        REM stx_switch is not yet defined - first run
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   798
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   799
            REM Detect if "" around a switch are used
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   800
            IF "!temp_string:~0,2!" EQU "!detect_double_quote!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   801
                SET stx_switch=!stx_switch! %%A
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   802
            REM Detect if '' around a switch are used and convert them to ""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   803
            ) ELSE IF "!temp_string:~0,2!" EQU "!detect_single_quote!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   804
                SET "changed_string=!temp_string:'="!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   805
                SET stx_switch=!stx_switch! !changed_string!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   806
            REM All other options
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   807
            ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   808
                SET stx_switch=^"%%A^"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   809
            )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   810
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   811
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   812
    REM clearing used variables
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   813
    SET detect_switch_double=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   814
    SET detect_single_switch=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   815
    SET detect_double_quote=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   816
    SET detect_single_quote=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   817
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   818
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   819
:: ======================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   820
:: Block CMD PowerShell mode from using manual Switches =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   821
:: ======================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   822
IF "!stx_manual_switch_detected!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   823
    IF "!stx.__binary.cmd_in_powershell!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   824
        ECHO:
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   825
        CALL :print_message !use_color! !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] You can not simultaneously pass command-line switches to stx.com and log using CMD PowerShell mode - __binary.cmd_in_powershell=TRUE" "[WARN] Switching off LOGGING and executing only via cmd.exe."
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   826
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   827
        SET stx.__binary.record_log_file=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   828
        SET stx.__binary.append_to_log=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   829
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   830
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   831
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   832
:: =================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   833
:: Three ways to start Smalltalk/X =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   834
:: =================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   835
:: TRUE;TRUE   - User will be asked for input; with which image to start
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   836
:: TRUE;FALSE  - Stx will start with the default image configured
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   837
:: FALSE;FALSE - Quick start - StX will start without an image
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   838
IF "!stx.__binary.start_with_image!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   839
    IF "!stx.__binary.list_available_images!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   840
        REM USER INPUT
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
   841
        CALL :user_menu !stx.image_path! stx.image_name !stx.image_suffix!
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
   842
        CALL :print_message !use_color! !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "[INFO] Loading selected image !stx.image_name!"
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
   843
        SET "user_selected_image=!stx.image_name!"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   844
        IF DEFINED internal_runtime_options (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   845
            SET stx_switch=!stx_switch! !internal_runtime_options! "--image" !user_selected_image!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   846
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   847
            SET stx_switch=!stx_switch! "--image" !user_selected_image!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   848
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   849
        SET user_selected_image=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   850
    ) ELSE (
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   851
        CALL :print_message !use_color! !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "[INFO] DEFAULT IMAGE: !stx.image_path:"=!!default_image_name:"=! starts"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   852
        IF DEFINED internal_runtime_options (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   853
            SET stx_switch="--image" !default_image_name! !internal_runtime_options! !stx_switch!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   854
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   855
            SET stx_switch="--image" !default_image_name! !stx_switch!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   856
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   857
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   858
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   859
    IF "!stx.__binary.stx_quick_start!" EQU "TRUE" (
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   860
        IF "!stx_manual_switch_detected!" EQU "TRUE" (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   861
            CALL :print_message !use_color! !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "[INFO] Manual switch detected - configuration is ignored"
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   862
            SET stx_switch= !stx_switch!
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   863
        ) ELSE IF DEFINED internal_runtime_options (
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   864
            SET stx_switch="--ignoreImage" !stx_switch! !internal_runtime_options! "--quick"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   865
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   866
            SET stx_switch="--ignoreImage" !stx_switch! "--quick"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   867
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   868
        REM clearing configured values
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   869
        SET stx.image_path=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   870
        SET default_image_name=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   871
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   872
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   873
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   874
:: =======================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   875
:: Check if user wants to command prompt =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   876
:: =======================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   877
:: note: cmd /U causes the output to pipes or file to be Unicode
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   878
IF "!stx.__binary.close_shell!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   879
    SET "cmd_close=/U /C"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   880
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   881
    SET "cmd_close=/U /K"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   882
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   883
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   884
:: =============================================================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   885
:: Check if the log file is not too big (with jumping into log file directory) =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   886
:: =============================================================================
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   887
:: NOTE: not using :print_message -> sending too many messages
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   888
:: Changing to log directory
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   889
pushd "!stx.log_directory!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   890
IF "!stx.__binary.append_to_log!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   891
    (FOR %%A IN (!log_filename!) DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   892
        SET file_size=%%~zA
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   893
    )) || REM
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   894
    IF ERRORLEVEL 1 (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   895
        SET "message="Error checking size of the file: !log_filename:"=!.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   896
        SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   897
        CALL :exit_sequence !message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   898
        GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   899
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   900
    IF !file_size! GEQ !stx.__numeric.warning_logfile_size! (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   901
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   902
        IF "!use_color!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   903
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "==================================================================================================================="
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   904
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] BIG_FAT_WARNING: your log file !log_filename:"=! is larger than !stx.__numeric.warning_logfile_size! Bytes. "
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   905
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] This can slow down your StX."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   906
            CALL :printInColor !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "==================================================================================================================="
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   907
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   908
            ECHO "====================================================================================================================="
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   909
            ECHO "[WARN] BIG_FAT_WARNING: your log file !log_filename:"=! is larger than !stx.__numeric.warning_logfile_size! Bytes. "
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   910
            ECHO "[WARN] This can slow down your StX."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   911
            ECHO "====================================================================================================================="
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   912
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   913
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   914
        PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   915
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   916
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   917
:: Return back from the log directory
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   918
popd
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   919
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   920
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   921
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   922
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   923
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   924
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   925
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   926
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   927
:: Running the command                                                                       *
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   928
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   929
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   930
:: =================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   931
:: Preparing command for execution =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   932
:: =================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   933
IF "!stx.__binary.record_log_file!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   934
    REM -WindowStyle Normal Sets the window style to Normal, Minimized, Maximized or Hidden.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   935
    REM -NoProfile - launches without a profile
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   936
    REM -ExecutionPolicy Bypass - does not ask for passwords if used privileged command.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   937
    SET exec_command$=CALL !powershell_exec! -WindowStyle Normal -nologo -noninteractive -NoProfile -ExecutionPolicy Bypass -Command "& {!powershell_script_file! -executable '!smalltalk_executable:"=!' -log_file '!stx.log_directory:"=!!log_filename:"=!' -log_file_encoding '!stx.log_file_encoding!' -append_to_log '!stx.__binary.append_to_log!' -cmd_close '!cmd_close!' -PowerShellVersion '!PowerShellVersion!' -cmd_in_powershell '!stx.__binary.cmd_in_powershell!' -stx_manual_switch_detected '!stx_manual_switch_detected!'};"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   938
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   939
    ECHO:
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   940
    CALL :print_message !use_color! !stx.stdout_WarningBackgroundColor! !stx.stdout_WarningForegroundColor! "[WARN] NO LOGGING"
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   941
    ECHO:
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
   942
    CALL :print_message !use_color! !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "[INFO] User disabled or limitation applies." "[INFO] Executing: cmd.exe !cmd_close:"=! CALL !smalltalk_executable:"=! !stx_switch!"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   943
    SET "exec_command$=cmd.exe !cmd_close! CALL !smalltalk_executable:"=! !stx_switch!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   944
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   945
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   946
:: ===========
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   947
:: Execution =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   948
:: ===========
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   949
:: An alternative working too
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   950
REM START /B /W !exec_command$!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   951
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
   952
:: An alternatives NOT working properly (for unknown reason) - as a warning 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   953
REM ECHO " "exec: !%exec_command%!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   954
REM CALL %%exec_command%%
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   955
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   956
:: Calling the dynamic variable exec_command$ this way works 100%
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   957
:: The suffix $ at the variable is to make sure there is no variable collision with the current environment
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   958
CALL !exec_command$!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   959
:: To view error level even from PowerShell
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   960
:: ECHO "Errorlevel: !errorlevel!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   961
:: PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   962
IF "%ERRORLEVEL%" NEQ "0" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   963
    SET "message="The command !exec_command$! was executed incorrectly.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   964
    SET __numeric.exit_value=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   965
    CALL :exit_sequence !message!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   966
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   967
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   968
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   969
:: ==================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   970
:: Correctly ending the application =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   971
:: ==================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   972
IF "__binary.close_shell" EQU "FALSE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   973
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   974
    IF "!use_color!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   975
        CALL :printInColor !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "[INFO] End. Waiting till final exit."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   976
    ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   977
        ECHO "[INFO] End. Waiting till final exit."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   978
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   979
    PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   980
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   981
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   982
    IF "!use_color!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   983
        CALL :printInColor !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "[INFO] End. Exiting correctly."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   984
    ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   985
        ECHO "[INFO] End. Exiting correctly."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   986
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   987
    IF "!stx.__binary.use_timer!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   988
        REM ===========================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   989
        REM End timer and show result =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   990
        REM ===========================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   991
        CALL :time_in_seconds __end
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   992
        ECHO "[INFO] timer end. Duration: !__end! [seconds]"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   993
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   994
        SET /A _elapsed=!__end!-!__start!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   995
        ECHO "[INFO] Timer: !_elapsed! seconds."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   996
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   997
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   998
ENDLOCAL
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
   999
EXIT /B 0
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1000
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1001
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1002
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1003
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1004
:: Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1005
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1006
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1007
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1008
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1009
:: User defined functions                                                                    *
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1010
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1011
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1012
:exit_sequence
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1013
IF "!__numeric.exit_value!" NEQ "0" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1014
    IF "%~1" NEQ "" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1015
        ECHO:
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1016
        CALL :print_message !use_color! !stx.stdout_ErrorForegroundColor! !stx.stdout_ErrorBackgroundColor! "[ERROR] "%1""
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1017
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1018
    IF "%~2" NEQ "" (
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1019
        CALL :print_message !use_color! !stx.stdout_ErrorForegroundColor! !stx.stdout_ErrorBackgroundColor! "[ERROR] "%2""
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1020
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1021
    ECHO:
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1022
    CALL :print_message !use_color! !stx.stdout_ErrorForegroundColor! !stx.stdout_ErrorBackgroundColor! "[ERROR] Exiting with error. Script __numeric.exit_value: !__numeric.exit_value!." "[ERROR] Batch errorlevel: !ERRORLEVEL!"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1023
    PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1024
    REM Cleanup namespace stx.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1025
    REM nul redirection stops error output if no stx. var is set
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1026
    FOR /F "tokens=1 delims==" %%V IN ('SET stx. 2^>NUL') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1027
        SET %%V=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1028
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1029
    REM Deallocate variables
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1030
    ENDLOCAL
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1031
    EXIT /B 1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1032
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1033
    ECHO:
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1034
    CALL :print_message !use_color! !stx.stdout_VerboseBackgroundColor! !stx.stdout_VerboseForegroundColor! "[INFO] Exiting correctly."
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1035
    REM Cleanup namespace stx.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1036
    REM nul redirection stops error output if no stx. var is set
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1037
    FOR /F "tokens=1 delims==" %%V IN ('SET stx. 2^>NUL') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1038
        SET %%V=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1039
    )
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1040
    
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1041
    call :cleanupColorPrint
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1042
    REM Deallocate variables
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1043
    ENDLOCAL
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1044
    EXIT /B 0
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1045
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1046
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1047
:: =============================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1048
:: Detect available powershell =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1049
:: =============================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1050
:powershell_detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1051
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1052
SET registry_path="HKLM\SOFTWARE\Microsoft\PowerShell"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1053
SET latest_powershell_version=0
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1054
SET runtime_version=""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1055
SET /A counter=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1056
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1057
:: Check if registry path to PowerShell exists
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1058
REG QUERY !registry_path!>NUL
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1059
IF /I "!ERRORLEVEL!" NEQ "0" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1060
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1061
    ECHO "[ERROR] Registry path: !registry_path! does not exist."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1062
    ECHO "[ERROR] Powershell NOT detected."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1063
    SET powershell_detected=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1064
    GOTO end_powershell_detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1065
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1066
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1067
:: ~ expands the given variable
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1068
:: The ^ escapes (protects) the pipe during the initial batch parsing.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1069
:: double %% is there as holder for FOR.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1070
:: :"= replaces all the double quotes in the variable with nothing
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1071
:: The '\\' in regexp is included for WindowsXP compatibility - req query returns also its version in the query
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1072
(FOR /F "delims=" %%A IN ('REG QUERY "!registry_path!" ^| FINDSTR "^.*\\[0-9]$"') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1073
    REM "ECHO "DEBUG:__PowerShellRegistryVersion.!counter!=%%~A"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1074
    SET __PowerShellRegistryVersion.!counter!=%%~A
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1075
    SET /A counter+=1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1076
)) || REM
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1077
IF ERRORLEVEL 1 (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1078
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1079
    ECHO "[ERROR] Query: REG QUERY "!registry_path!" ^| FINDSTR "^.*\\[0-9]$" probably error in registry."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1080
    SET powershell_detected=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1081
    PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1082
    GOTO end_powershell_detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1083
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1084
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1085
:: Found powershell registry token=2* takes 'counter=registry path'. delims== selects everything right of "="; ending with only registry path.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1086
(FOR /F "tokens=2* delims==" %%A IN ('SET __PowerShellRegistryVersion.') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1087
    (FOR /F "tokens=3" %%R IN ('REG QUERY %%~A /v Install ^| FIND "Install"') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1088
        SET PowerShellInstalled=%%~R
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1089
    )) || REM
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1090
    IF ERRORLEVEL 1 (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1091
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1092
        ECHO "[ERROR] Query: REG QUERY "REG QUERY %%~A /v Install ^| FIND "Install" did not find any Install key. probably error in registry."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1093
        SET powershell_detected=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1094
        PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1095
        GOTO end_powershell_detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1096
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1097
    IF "!PowerShellInstalled!" NEQ "0x1" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1098
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1099
        ECHO "[INFO] The PowerShell PSCompatibleVersion ^(1.0 or 2.0^) is not installed."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1100
        SET powershell_detected=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1101
        GOTO end_powershell_detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1102
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1103
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1104
    (FOR /F "tokens=3" %%P IN ('REG QUERY "%%~A\PowerShellEngine" /v PowerShellVersion ^| FIND "PowerShellVersion"') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1105
        SET PowerShellVersion=%%~P
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1106
    )) || REM
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1107
    IF ERRORLEVEL 1 (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1108
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1109
        ECHO "[ERROR] Query: REG QUERY "REG QUERY "%%~A\PowerShellEngine" /v PowerShellVersion ^| FIND "PowerShellVersion"" did not find any PowerShellVersion key. probably error in registry."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1110
        SET powershell_detected=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1111
        PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1112
        GOTO end_powershell_detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1113
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1114
    REM GEQ - greater than or equal
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1115
    IF "!PowerShellVersion!" GEQ "!minimal_powershell_version!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1116
        SET powershell_detected=TRUE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1117
    ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1118
        SET powershell_detected=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1119
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1120
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1121
    FOR /F "tokens=3" %%V IN ('REG QUERY "%%~A\PowerShellEngine" /v RuntimeVersion ^| FIND "RuntimeVersion"') DO SET RuntimeVersion=%%~V
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1122
    IF "!latest_powershell_version!" LSS "!PowerShellVersion!" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1123
        SET latest_powershell_version=!PowerShellVersion!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1124
        SET runtime_version=!RuntimeVersion!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1125
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1126
)) || REM
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1127
    IF ERRORLEVEL 1 (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1128
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1129
        ECHO "[ERROR] Command SET __PowerShellRegistryVersion.  Something wrong with your shell (command prompt)."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1130
        SET powershell_detected=FALSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1131
        PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1132
        GOTO end_powershell_detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1133
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1134
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1135
IF "!powershell_detected!" EQU "TRUE" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1136
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1137
    ECHO "[INFO] PowerShell detected: ->!powershell_detected!<-.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1138
    ECHO "[INFO] The latest latest_powershell_version found: !latest_powershell_version!."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1139
    ECHO "[INFO] With the runtime being: !runtime_version!."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1140
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1141
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1142
    ECHO "[INFO] PowerShell NOT detected. Fallback mode activated.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1143
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1144
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1145
:end_powershell_detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1146
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1147
SET "%~1=!powershell_detected!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1148
SET "%~2=!latest_powershell_version!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1149
SET "%~3=!runtime_version!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1150
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1151
EXIT /B
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1152
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1153
:: ==================
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1154
:: Create user menu =
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1155
:: ==================
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1156
:user_menu
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1157
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1158
:: Normal path can be with or without double quotes.  If the path contains spaces it must be enclosed by double quotes.
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1159
SET "input_image_path=%~1"
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1160
SET "input_image_suffix=%~3"
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1161
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1162
:: Init
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1163
SET /A counter_get_answer=1
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1164
SET /A counter_get_file=1
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1165
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1166
:: %%A - double %% due to FOR loop and %A as an array
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1167
:: within FOR filename with suffix: %%~nxA
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1168
:: For does not change ERRORLEVEL but uses exit_code for more see: http://stackoverflow.com/questions/34987885/what-are-the-errorlevel-values-set-by-internal-cmd-exe-commands 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1169
:: However, the '|| REM' trick captures the ERRORLEVEL from the DIR executed as for command.
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1170
:: -DN - order by date (the newest first) and in alphabetic order
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1171
ECHO "--------------- User input ------------------------------------------------------------------------------------"
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1172
ECHO "Select your stx image (sorted from the newest; if files of same then alphabetic order is used):"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1173
ECHO:
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1174
(FOR /F "delims=" %%A IN ('dir !input_image_path!^*^.!input_image_suffix! /B /O^:-DN 2^>NUL') DO (
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1175
    SET "__stx_image_path.%counter_get_answer%=%%~dpnxA"
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1176
    ECHO "[!counter_get_answer!]  => !__stx_image_path.%counter_get_answer%!
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1177
    SET /A counter_get_answer+=1
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1178
)) || REM
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1179
IF ERRORLEVEL 1 (
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1180
    ECHO "No files with mask !input_image_path:"=!^*^.!input_image_suffix:"=!"
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1181
    ECHO "Will exit now."
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1182
    PAUSE
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1183
    REM This is a "trick" to exit directly the function
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1184
    REM (GOTO) 2^^>NUL behaves nearly same as exit /B but executes the block behind it
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1185
    (GOTO) 2>NUL & ENDLOCAL & EXIT /B
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1186
)
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1187
ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1188
ECHO "[0]  Exit"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1189
ECHO:
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1190
ECHO "---------------------------------------------------------------------------------------------------------------"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1191
ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1192
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1193
SET /P user_input="Enter a choice: "
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1194
:: -----------------------------
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1195
:: prevent hijacking the input -
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1196
:: -----------------------------
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1197
:: ECHO "DEBUG: .!user_input!.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1198
:: ECHO "DEBUG: strip quotes: .!user_input:"=!.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1199
SET user_input=!user_input:"=!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1200
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1201
:: If you really want to reject the variable with any quotation mark...
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1202
:: FIND /V-  Displays all lines NOT containing the specified string.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1203
SET user_input | FIND /V """" >NUL
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1204
IF ERRORLEVEL 1 (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1205
   SET user_input=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1206
   ECHO "[ERROR] You are trying to hijack the input. Exiting."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1207
   ECHO "[ERROR] Batch errorlevel: !ERRORLEVEL!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1208
   PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1209
   REM This is a "trick" to exit directly the function
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1210
   REM (GOTO) 2^^>NUL behaves nearly same as exit /B but executes the block behind it
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1211
   (GOTO) 2>NUL & ENDLOCAL & EXIT /B 1
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1212
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1213
:: ---------------------------------
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1214
:: END prevent hijacking the input -
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1215
:: ---------------------------------
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1216
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1217
:: User choose to exit
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1218
IF "!user_input!" EQU "0" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1219
    ECHO "[INFO] You have selected to exit voluntary. Goodbye."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1220
    (GOTO) 2>NUL & ENDLOCAL & EXIT /B 0
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1221
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1222
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1223
REM A solution for unknown number of options at the time asking the question
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1224
REM ugh must not be used anywhere else!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1225
REM Verification that user has entered a number from the given selection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1226
SET "ugh="&FOR /F "delims=0123456789" %%I IN ("!user_input!") DO SET "ugh=%%~I"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1227
IF defined ugh (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1228
    ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1229
    ECHO "[INFO] The input -> !user_input! <- was outside the given choices."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1230
    SET ugh=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1231
    PAUSE
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1232
    GOTO user_menu
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1233
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1234
    IF "!user_input!" GTR "0" (
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1235
        IF "!user_input!" LSS "!counter_get_answer!" (
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1236
            REM ECHO "DEBUG: Your answer is: -> %user_input% <-."
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1237
            SET "verified_user_input=!user_input!"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1238
        ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1239
            ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1240
            ECHO "[INFO] The input2 -> !user_input! <- was outside the given choices."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1241
            PAUSE
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1242
            GOTO user_menu
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1243
        )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1244
    ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1245
        ECHO:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1246
        ECHO "[INFO] The input3 -> !user_input! <- was outside the given choices."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1247
        PAUSE
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1248
        GOTO user_menu
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1249
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1250
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1251
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1252
:: Getting path and file name from user answer
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1253
SET stx_break=
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1254
(FOR /F "delims=" %%A IN ('dir !input_image_path!^*^.!input_image_suffix! /B /O^:-DN 2^>NUL') DO IF NOT DEFINED stx_break (
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1255
    IF "!verified_user_input!" EQU "!counter_get_file!" (
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1256
      SET "__stx_image_path="%%~dpnxA""
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1257
      SET stx_break=yes
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1258
    ) ELSE IF "!counter_get_answer!" LSS "!counter_get_file!" (
1518
2d2ecaa57521 version 1.5.0 Removing unneeded variable (in menu) and adding error message for user
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1517
diff changeset
  1259
      SET "__stx_image_path="Unknown path""
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1260
      SET stx_break=yes
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1261
    )
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1262
    SET /A counter_get_file+=1
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1263
)) || REM
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1264
IF ERRORLEVEL 1 (
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1265
    ECHO "Error converting the user answer ->!verified_user_input! to path."
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1266
    PAUSE
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1267
    REM This is a "trick" to exit directly the function
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1268
    REM (GOTO) 2^^>NUL behaves nearly same as exit /B but executes the block behind it
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1269
    (GOTO) 2>NUL & ENDLOCAL & EXIT /B
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1270
)
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1271
:: Clearing
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1272
SET stx_break=
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1273
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1274
SET "%2=!__stx_image_path!"
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1275
SET !__stx_image_path=
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1276
SET verified_user_input=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1277
SET input_image_path=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1278
SET input_image_suffix=
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1279
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1280
EXIT /B
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1281
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1282
:: ======================================
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1283
:: Printing stdout messages with colors =
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1284
:: ======================================
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1285
:print_message
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1286
SET "use_color=%1"
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1287
SET "stdout_VerboseBackgroundColor=%2"
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1288
SET "stdout_VerboseForegroundColor=%3"
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1289
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1290
SET "message1=%4"
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1291
SET "message2=%5"
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1292
SET "message3=%6"
1524
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1293
1515
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1294
IF "%use_color%" EQU "TRUE" (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1295
    IF DEFINED message1 (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1296
        CALL :printInColor %stdout_VerboseBackgroundColor% %stdout_VerboseForegroundColor% %message1%
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1297
    ) ELSE (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1298
        CALL :printInColor %stdout_VerboseBackgroundColor% %stdout_VerboseForegroundColor% "[ERROR] No message defined."
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1299
    )
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1300
    IF DEFINED message2 (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1301
        CALL :printInColor %stdout_VerboseBackgroundColor% %stdout_VerboseForegroundColor% %message2%
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1302
        IF DEFINED message3 (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1303
            CALL :printInColor %stdout_VerboseBackgroundColor% %stdout_VerboseForegroundColor% %message2%
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1304
        )
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1305
    )
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1306
) ELSE (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1307
    IF DEFINED message1 (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1308
        ECHO "%message1%"
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1309
    ) ELSE (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1310
        ECHO "[ERROR] No message defined."
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1311
    )
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1312
    IF DEFINED message2 (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1313
        ECHO "%message2%"
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1314
        IF DEFINED message3 (
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1315
            ECHO "%message3%"
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1316
        )
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1317
    )
919fad4de40f version 1.4.6
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1514
diff changeset
  1318
)
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1319
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1320
:: ======================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1321
:: Native Shell coloring for Windows 10 =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1322
:: ======================================
1517
b4fbe9971044 version 1.4.9
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1516
diff changeset
  1323
:: just stub - NOT FINISHED!!!
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1324
:printInColorWin10
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1325
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1326
:: Windows 10 detection
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1327
::FOR /F "tokens=2 delims=[" %%I IN ('ver') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1328
::   ECHO %%I
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1329
::   FOR /F "tokens=2-3 delims=. " %%V IN ("%%I") DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1330
::       SET version=%%V.%%W
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1331
::       IF "!version!" LSS "10.0" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1332
::           ECHO "Older windows than Windows 10"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1333
::       ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1334
::           ECHO "Windows 10 or newer"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1335
::       )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1336
::   )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1337
::)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1338
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1339
:: ANSI Colors for Windows 10
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1340
REM ECHO [101;93m STYLES [0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1341
REM ECHO ^<ESC^>[0m [0mReset[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1342
REM ECHO ^<ESC^>[1m [1mBold[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1343
REM ECHO ^<ESC^>[4m [4mUnderline[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1344
REM ECHO ^<ESC^>[7m [7mInverse[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1345
REM ECHO.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1346
REM ECHO [101;93m NORMAL FOREGROUND COLORS [0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1347
REM ECHO ^<ESC^>[30m [30mBlack[0m (black)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1348
REM ECHO ^<ESC^>[31m [31mRed[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1349
REM ECHO ^<ESC^>[32m [32mGreen[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1350
REM ECHO ^<ESC^>[33m [33mYellow[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1351
REM ECHO ^<ESC^>[34m [34mBlue[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1352
REM ECHO ^<ESC^>[35m [35mMagenta[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1353
REM ECHO ^<ESC^>[36m [36mCyan[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1354
REM ECHO ^<ESC^>[37m [37mWhite[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1355
REM ECHO.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1356
REM ECHO [101;93m NORMAL BACKGROUND COLORS [0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1357
REM ECHO ^<ESC^>[40m [40mBlack[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1358
REM ECHO ^<ESC^>[41m [41mRed[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1359
REM ECHO ^<ESC^>[42m [42mGreen[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1360
REM ECHO ^<ESC^>[43m [43mYellow[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1361
REM ECHO ^<ESC^>[44m [44mBlue[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1362
REM ECHO ^<ESC^>[45m [45mMagenta[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1363
REM ECHO ^<ESC^>[46m [46mCyan[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1364
REM ECHO ^<ESC^>[47m [47mWhite[0m (white)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1365
REM ECHO.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1366
REM ECHO [101;93m STRONG FOREGROUND COLORS [0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1367
REM ECHO ^<ESC^>[90m [90mWhite[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1368
REM ECHO ^<ESC^>[91m [91mRed[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1369
REM ECHO ^<ESC^>[92m [92mGreen[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1370
REM ECHO ^<ESC^>[93m [93mYellow[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1371
REM ECHO ^<ESC^>[94m [94mBlue[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1372
REM ECHO ^<ESC^>[95m [95mMagenta[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1373
REM ECHO ^<ESC^>[96m [96mCyan[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1374
REM ECHO ^<ESC^>[97m [97mWhite[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1375
REM ECHO.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1376
REM ECHO [101;93m STRONG BACKGROUND COLORS [0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1377
REM ECHO ^<ESC^>[100m [100mBlack[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1378
REM ECHO ^<ESC^>[101m [101mRed[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1379
REM ECHO ^<ESC^>[102m [102mGreen[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1380
REM ECHO ^<ESC^>[103m [103mYellow[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1381
REM ECHO ^<ESC^>[104m [104mBlue[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1382
REM ECHO ^<ESC^>[105m [105mMagenta[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1383
REM ECHO ^<ESC^>[106m [106mCyan[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1384
REM ECHO ^<ESC^>[107m [107mWhite[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1385
REM ECHO.
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1386
REM ECHO [101;93m COMBINATIONS [0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1387
REM ECHO ^<ESC^>[31m                     [31mred foreground color[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1388
REM ECHO ^<ESC^>[7m                      [7minverse foreground ^<-^> background[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1389
REM ECHO ^<ESC^>[7;31m                   [7;31minverse red foreground color[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1390
REM ECHO ^<ESC^>[7m and nested ^<ESC^>[31m [7mbefore [31mnested[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1391
REM ECHO ^<ESC^>[31m and nested ^<ESC^>[7m [31mbefore [7mnested[0m
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1392
GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1393
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1394
:: ============================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1395
:: Coloring of information text in Batch file =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1396
:: ============================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1397
:: There is no native support for ANSI colors on the console till Windows 10 (excluded).
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1398
:: It is rather tricky to color only one line just via CMD - any hack does not work properly with this complex batch file
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1399
:: The best way till Windows 10 is actually to use PowerShell!  In Windows 10 the proper use is to use native ANSI colors (not done yet).
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1400
:printInColor
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1401
SET "background=%1"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1402
SET "foreground=%2"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1403
SET "message=%3"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1404
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1405
REM Message was "'%*'" but now since we are passing colors we have to limit it
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1406
:: Saves original color and then sets the new color for the message
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1407
SET long_command= ^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1408
$window_private_data = (Get-Host).PrivateData;^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1409
$saved_background_color = $window_private_data.VerboseBackgroundColor;^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1410
$saved_foreground_color = $window_private_data.VerboseForegroundColor;^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1411
$window_private_data.VerboseBackgroundColor = "'%background%'";^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1412
$window_private_data.VerboseForegroundColor = "'%foreground%'";^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1413
Write-Verbose -Message "'%message%'" -Verbose;^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1414
$window_private_data.VerboseBackgroundColor = $saved_background_color;^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1415
$window_private_data.VerboseForegroundColor = $saved_foreground_color;
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1416
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1417
CALL powershell -nologo -noninteractive -NoProfile -ExecutionPolicy Bypass -Command %long_command%
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1418
GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1419
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1420
:time_in_seconds
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1421
FOR /F %%A IN ('wmic os get LocalDateTime ^| find "."') DO (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1422
    SET dts=%%A
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1423
    REM Issue with octal representation (08 and 09 are invalid octal representation and others are too but are accepted)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1424
    REM Workaround implemented below:
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1425
    IF "!dts:~8,1!" EQU "0" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1426
        SET hours=!dts:~9,1!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1427
    ) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1428
        SET hours=!dts:~8,2!
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1429
    )
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1430
    SET /A _time_in_seconds=!hours!*3600^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1431
                            +!dts:~10,1!*10*60^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1432
                            +!dts:~11,1!*60^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1433
                            +!dts:~12,1!*10^
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1434
                            +!dts:~13,1! >nul
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1435
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1436
SET "%~1=!_time_in_seconds!"
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1437
GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1438
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
  1439
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1440
:: =============================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1441
:: Expanding variables from configuration file =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1442
:: =============================================
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1443
:: Must be last in this section
1516
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
  1444
:expand_path
4b143ef7d138 version 1.4.8
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1515
diff changeset
  1445
SET "%2=%1"
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1446
GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1447
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1448
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1449
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1450
REM Next section follows 
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1451
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1452
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1453
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1454
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1455
:: Support information (like help, about, version)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1456
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1457
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1458
:: ==============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1459
:: Help section =
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1460
:: ==============
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1461
:stx_help
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1462
IF EXIST "stx-bin.com" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1463
    CALL stx-bin.com --help
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1464
) ELSE IF EXIST "stx.com" (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1465
    CALL stx.com --help
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1466
) ELSE (
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1467
    ECHO "[WARN] The executable stx-bin.^(com^|exe^) or stx.^(com^|exe^) NOT found.""
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1468
    ECHO "[WARN] Exiting with error. Script __numeric.exit_value: 1."
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1469
    PAUSE
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1470
    GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1471
)
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1472
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1473
GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1474
1524
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1475
:stx_help_launcher
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1476
ECHO ====================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1477
ECHO The configuration: =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1478
ECHO ====================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1479
ECHO Note: The configuration is done via .cfg file.  The only configuration that can be done in the batch file
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1480
ECHO        is for the configuration file itself.  You can change the configuration path via configuration_file_path variable
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1481
ECHO        and the configuration file name via configuration_file variable.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1482
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1483
ECHO Note2: Notice that Microsoft is using Unicode as an alias for UTF16 (which is wrong but we have to deal with it).
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1484
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1485
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1486
ECHO ======================================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1487
ECHO The features of this advanced script =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1488
ECHO ======================================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1489
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1490
ECHO -- Quick start (with close or leave open the shell after Smalltalk start)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1491
ECHO -- Starting with default image on defined path
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1492
ECHO -- Starting with any image (user is prompted to select one via menu) on defined path
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1493
ECHO -- Logging into a file - either overwrite or append at start start (minimal PowerShell 2.0 is required)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1494
ECHO                        - User can change the log file encoding to ASCII, UTF8 (default), UTF16, UTF32
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1495
ECHO                        - User can decide if he wants a date and/or time part added to the log file
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1496
ECHO -- The script automatically detects PowerShell version and based on that decides which functionality will be available.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1497
ECHO -- Error handling on the batch and PowerShell level - user is informed about the details of error
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1498
ECHO -- Batch file tries to exit gracefully, if possible
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1499
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1500
ECHO The advanced features:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1501
ECHO -- A warning limit is in place for the log file size.  If it gets too large as it may slowdown the Smalltalk.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1502
ECHO -- User can decide if there will be a shell opened for error messages or if Smalltalk will for from shell and
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1503
ECHO    will not display any messages on the command prompt.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1504
ECHO -- User can choose if the validation process is active and if the successful message is shown.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1505
ECHO -- User can choose which redirect will be used in PowerShell - if the native one or cmd.exe one (little bit faster in most cases).
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1506
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1507
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1508
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1509
ECHO -------------------------------------------------------------------------------------------
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1510
ECHO User settings
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1511
ECHO -------------------------------------------------------------------------------------------
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1512
ECHO: ===================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1513
ECHO Stx bin directory =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1514
ECHO ===================
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1515
ECHO Setting: stx_bin_dir - 
1524
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1516
ECHO Impact: defines the directory containing the executable
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1517
ECHO Note: do not forget the last backslash ^(\^) and double quotes when changing to custom path
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1518
ECHO stx_bin_dir="%~dp0"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1519
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1520
ECHO ===================================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1521
ECHO Stx quick start and image details =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1522
ECHO ===================================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1523
ECHO Setting: __binary.stx_quick_start
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1524
ECHO Impact: Uses flags --ignoreImage and --quick start to start StX as fast as possible
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1525
ECHO TRUE - switches on the quick start
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1526
ECHO FALSE - skips this option
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1527
ECHO __binary.stx_quick_start=FALSE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1528
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1529
ECHO Setting: image_path, image_name, image_suffix
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1530
ECHO Impact: variables are self-explanatory
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1531
ECHO Note: do not forget the last backslash ^(\^) and double quotes when changing to custom path
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1532
ECHO image_path="%~dp0"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1533
ECHO Setting: image_name - how should the default image be named
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1534
ECHO image_name="st"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1535
ECHO image_suffix=".img"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1536
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1537
ECHO Impact: Pair variables (affect each other):__binary.start_with_image and __binary.list_available_images
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1538
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1539
ECHO note: Before using image functionality check image path, name, and suffix
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1540
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1541
ECHO Setting: __binary.start_with_image
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1542
ECHO Impact: Stx starts (or not) with image.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1543
ECHO TRUE - image functionality will be used
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1544
ECHO FALSE - image functionality ignored
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1545
ECHO __binary.start_with_image=FALSE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1546
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1547
ECHO Setting: __binary.list_available_images
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1548
ECHO Impact: User menu is show when used; it shows all images within the directory (excluding subdirectories) and users selects one.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1549
ECHO        If switched off only default image (see image_path, image_name, image_suffix) is used.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1550
ECHO Note: IF start_with_image=FALSE and list_available_images=TRUE then a warning message is shown and append_to_log is set to FALSE automatically)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1551
ECHO TRUE - Switches on the user menu
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1552
ECHO FALSE - no interaction from user required
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1553
ECHO __binary.list_available_images=FALSE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1554
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1555
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1556
ECHO =================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1557
ECHO Stx logging     =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1558
ECHO =================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1559
ECHO Impact: Pair variables (affect each other): __binary.record_log_file and __binary.append_to_log
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1560
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1561
ECHO Setting: __binary.record_log_file
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1562
ECHO Impact: Both standard output and standard error are redirected to a log file
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1563
ECHO Note: At least PowerShell 2.0 is required (WindowsXP and newer)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1564
ECHO TRUE - turns on the logging functionality
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1565
ECHO FALSE - turns off the logging
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1566
ECHO __binary.record_log_file=TRUE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1567
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1568
ECHO Setting: __binary.append_to_log
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1569
ECHO Impact: Appends the log file.  Uses a PowerShell when appending.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1570
ECHO Note: IF record_log_file=FALSE and append_to_log=TRUE then a warning message is shown and append_to_log is set to FALSE automatically)
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1571
ECHO TRUE - if log file is found it will be appended.  If not a new one will be created 
1524
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1572
ECHO FALSE - the append functionality is turned off (the log file will be overwritten every time StX is executed)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1573
ECHO __binary.append_to_log=TRUE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1574
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1575
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1576
ECHO Setting: log_directory, log_name, log_suffix
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1577
ECHO Impact: Directory sets a log file directory (others are self-explanatory)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1578
ECHO If a change would be done, double quotes must be present: e.g. "C:\prg_sdk\Stx_stable\"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1579
ECHO Note: do not forget the last backslash ^(\^) and double quotes when changing to custom path
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1580
ECHO log_directory="%~dp0"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1581
ECHO Setting: log_name sets name for log file
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1582
ECHO log_name="smalltalk"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1583
ECHO log_suffix=".log"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1584
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1585
ECHO Setting: __binary.log_add_datepart
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1586
ECHO Impact: Adds a date part based on ISO 8601 to the log file; format YYYY-MM-DD ('-' as a separator)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1587
ECHO TRUE - Switch on this option
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1588
ECHO FALSE - Skips this option
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1589
ECHO __binary.log_add_datepart=TRUE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1590
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1591
ECHO Setting: __binary.log_add_timepart
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1592
ECHO Impact: Adds a time part to the log file; format hh;mm;ss (non-ISO ';' as a separator)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1593
ECHO Note: the ISO 8601 separator is not compatible with file-system)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1594
ECHO TRUE - Switch on this option
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1595
ECHO FALSE - Skips this option
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1596
ECHO __binary.log_add_timepart=FALSE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1597
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1598
ECHO Setting: log_file_encoding
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1599
ECHO Impact: Changes log file encoding
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1600
ECHO Allowed values ASCII, UTF8 (default), UTF16 (in Microsoft world that is called Unicode), UTF32
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1601
ECHO Note: only UTF16 is using Tee-Object which enables you to have all the features the developer envisioned for the logging process
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1602
ECHO       you can simultaneously see the output in shell, view the log file while using StX and have the wished encoding
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1603
ECHO       all other encodings carry some limitation due to the powershell tools limitation
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1604
ECHO log_file_encoding=UTF8
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1605
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1606
ECHO =================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1607
ECHO Stx shell       =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1608
ECHO =================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1609
ECHO Setting: __binary.close_shell
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1610
ECHO Impact: When set to TRUE closes the shell upon StX exit
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1611
ECHO TRUE - Switch on this option
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1612
ECHO FALSE - Skips this option
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1613
ECHO __binary.close_shell=TRUE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1614
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1615
ECHO Setting: __binary.run_via_shell
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1616
ECHO Impact: start with shell (.com) or just the GUI without shell (.exe)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1617
ECHO TRUE - uses stx.com executable
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1618
ECHO FALSE - uses stx.exe executable
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1619
ECHO __binary.run_via_shell=TRUE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1620
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1621
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1622
ECHO -------------------------------------------------------------------------------------------
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1623
ECHO Advanced user settings
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1624
ECHO -------------------------------------------------------------------------------------------
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1625
ECHO ====================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1626
ECHO Validate variables =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1627
ECHO ====================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1628
ECHO: Setting: verify_variables_syntax
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1629
ECHO Impact: Verifies the syntax of the batch file variables - e.g. batch file is very picky on spaces
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1630
ECHO TRUE - active validation
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1631
ECHO FALSE - inactive validation (NOT recommended)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1632
ECHO verify_variables_syntax=TRUE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1633
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1634
ECHO Setting: verify_print_message
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1635
ECHO Impact: shows message when the verification is complete
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1636
ECHO TRUE - Switch on this option
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1637
ECHO FALSE - message is not shown
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1638
ECHO verify_print_message=FALSE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1639
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1640
ECHO =======================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1641
ECHO Log file size warning =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1642
ECHO =======================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1643
ECHO Setting: __numeric.warning_logfile_size - Above what file size should a log file warning be shown?
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1644
ECHO Impact: If the limit is reached a warning message is shown to the user
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1645
ECHO Print user waring if the log file is getting too big - for 32MB in bytes
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1646
ECHO the bigger log-file, the slower the logging process gets
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1647
ECHO __numeric.warning_logfile_size=33554432
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1648
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1649
ECHO ====================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1650
ECHO Stdout redirection =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1651
ECHO ====================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1652
ECHO Setting: cmd_in_powershell
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1653
ECHO Impact: The cmd.exe redirection is faster even when called from powershell
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1654
ECHO         There could be unforeseen issues with it so there is a switch (no manual switches are allowed)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1655
ECHO         When no colors are used then black background and gray foreground is used (warning messages are still highlighted)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1656
ECHO         When colors are used then the same color schema is used
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1657
ECHO TRUE - uses cmd.exe for redirecting output
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1658
ECHO FALSE - uses powershell for redirection (default)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1659
ECHO __binary.cmd_in_powershell=TRUE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1660
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1661
ECHO =============
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1662
ECHO Start timer =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1663
ECHO =============
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1664
ECHO Setting: use_timer
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1665
ECHO Impact: Measures time between start of the script and correct ending. Measurement unit are seconds.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1666
ECHO TRUE - uses timer
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1667
ECHO FALSE - switches off timer
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1668
ECHO __binary.use_timer=FALSE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1669
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1670
ECHO ==============
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1671
ECHO Colored text =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1672
ECHO ==============
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1673
ECHO Setting: colored_stdout
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1674
ECHO Impact: Will adjust based on the color setting the stdout output from both batch and powershell
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1675
ECHO        note: in powershell there are default colors used when setting is is turned off (FALSE.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1676
ECHO TRUE - uses colored output
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1677
ECHO FALSE - uses default colors available
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1678
ECHO __binary.colored_stdout=TRUE
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1679
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1680
ECHO ===================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1681
ECHO Stdout text color =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1682
ECHO ===================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1683
ECHO colors that can be used
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1684
ECHO Black, DarkBlue, DarkGreen, DarkCyan, DarkRedDarkMagenta, DarkYellow,
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1685
ECHO Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1686
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1687
ECHO - verbose text (this is color used for normal usually [INFO] messages)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1688
ECHO stdout_VerboseBackgroundColor=Black
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1689
ECHO stdout_VerboseForegroundColor=DarkGreen
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1690
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1691
ECHO - warning text
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1692
ECHO stdout_WarningBackgroundColor=Black
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1693
ECHO stdout_WarningForegroundColor=Yellow
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1694
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1695
ECHO - error
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1696
ECHO stdout_ErrorBackgroundColor=White
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1697
ECHO stdout_ErrorForegroundColor=Red
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1698
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1699
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1700
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1701
ECHO ===================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1702
ECHO Known limitations =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1703
ECHO ===================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1704
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1705
ECHO 1) For any logging you need to have at least PowerShell 2.0
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1706
ECHO 2) User menu searches only the log_directory.  The subdirectories are excluded from the search (doable but the script is already too complex)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1707
ECHO 3) When logging user can chose to use colors or not.  If user does not wish to have custom color then no color for batch file and native colors in powershell are used.
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1708
ECHO 4) When using "pure" powershell redirection an error is shown at the start of the log file that is a bug in powershell (produces error: FullyQualifiedErrorId : NativeCommandError ) 
1524
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1709
ECHO    The error can be ignored.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1710
ECHO 5) The .lnk files are tested on Windows 7 SP1 (known to not work on Windows XP, you have to use the batch file directly.)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1711
ECHO 6) When using CMD PowerShell mode manual (user) switches can not be used.  When used the batch file forces CMD only mode.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1712
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1713
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1714
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1715
ECHO usage: (%~nx0) [--help] [--help-launcher] [--about] [--version] [stx shell switches]
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1716
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1717
ECHO args to startup script:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1718
ECHO       --help or -h or /h or /? ................ displays "stx.com" help
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1719
ECHO       --help-launcher or -h-l or /h-l ......... displays "%~nx0" help
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1720
ECHO       --about or -a or /a      ................ shows about section
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1721
ECHO       --version or -v or /v    ................ version information about %~nx0 and Smalltalk/X
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1722
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1723
ECHO In the future:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1724
ECHO      --ldd .................. show which shared libraries are used - NOT DONE YET
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1725
ECHO      --gdb .................. run with gdb-Debugger - NOT DONE YET
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1726
ECHO      --cgdb ................. run with cgdb-Debugger - NOT DONE YET
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1727
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1728
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1729
:: This section is commented out on purpose - There are tricks for batch files -> does not need to be part of the user help
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1730
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1731
:: " =================================="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1732
:: " Batch or Powershell Tip & tricks ="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1733
:: " =================================="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1734
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1735
:: " =============================================="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1736
:: " Tee-Object, Add-Content, Out-File + encoding ="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1737
:: " =============================================="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1738
::The 'Tee-object' and Add-Content was introduced in PowerShell 3.0 -> that the reason why there is such limitation.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1739
::
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1740
::The reason why the script is using also different logging types than 'Tee-object' is the fact that 'Tee-Object'
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1741
::supports only UTF16 (alias Unicode in Microsoft world) encoding.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1742
::Note: 'Tee-Object' append flag is '-a' (note: for 'tee' command it is '--append')
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1743
::
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1744
::'Add-content' can change encoding and you can view the messages in the shell but you can not view the file when StX is running (locked even for read)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1745
::'Out-File' can also change encoding, but you will not see the messages in the shell (only in StX launcher).  On the other hand you can view the file during
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1746
::StX session.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1747
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1748
:: " =============================================="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1749
:: " Empty lines in batch files ="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1750
:: " =============================================="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1751
:: NOTE: ECHO: is a reliable and fast way to print empty line.  Other ways are: ECHO( ECHO/
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1752
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1753
:: " =============="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1754
:: " Redirections ="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1755
:: " =============="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1756
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1757
REM powershell ... cmd.exe /c command '2>&1' -> Let cmd.exe handle redirection
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1758
REM powershell ... cmd.exe /c command 2>&1 -> Let powershell.exe handle redirection
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1759
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1760
REM Details
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1761
REM PowerShell:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1762
REM cmd.exe /c command 2>&1 -> redirect error stream (2) to success stream (1)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1763
REM fixes it when running from within PS but not the command prompt
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1764
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1765
REM Batch file:
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1766
REM ...cmd /c "ECHO "Hello from standard error 1>&2" 2>&1 | %{ "$_" } | tee... 
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1767
REM 
1524
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1768
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1769
:: " ====================="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1770
:: " Exiting batch files ="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1771
:: " ====================="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1772
:: To require pressing ctrl+C from the user (alias force ctrl+C)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1773
:: cmd /c exit -1073741510
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1774
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1775
:: To directly exit user function (used via CALL)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1776
:: This is a "trick" to exit directly the function
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1777
:: (GOTO) 2^^>NUL behaves nearly same as exit /B but executes the block behind it
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1778
:: (GOTO) 2>NUL & ENDLOCAL & EXIT /B 1
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1779
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1780
:: " ========================"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1781
:: " Miscellaneous in batch ="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1782
:: " ========================"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1783
:: A nice solution for printing out a known number of options:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1784
:: for %%I in (1 2 3 4 5 x) do if #%user_input%==#%%I goto run%%I
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1785
:: then you have to have label for every number e.g. :run1, :run2
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1786
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1787
GOTO :EOF
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1788
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1789
:: ===============
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1790
:: About section =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1791
:: ===============
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1792
:stx_about
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1793
ECHO " _____                 _ _ _        _ _         ____   __               "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1794
ECHO "/  ___|               | | | |      | | |       / /\ \ / /               "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1795
ECHO "\ `--. _ __ ___   __ _| | | |_ __ _| | | __   / /  \ V /                "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1796
ECHO " `--. \ '_ ` _ \ / _` | | | __/ _` | | |/ /  / /   /   \                "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1797
ECHO "/\__/ / | | | | | (_| | | | || (_| | |   <  / /   / /^\ \               "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1798
ECHO "\____/|_| |_| |_|\__,_|_|_|\__\__,_|_|_|\_\/_/    \/   \/               "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1799
ECHO "                                                                        "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1800
ECHO " _    _ _                  _                            _               "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1801
ECHO "| |  | (_)                | |                          | |              "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1802
ECHO "| |  | |_ _ __    ______  | |     __ _ _   _ _ __   ___| |__   ___ _ __ "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1803
ECHO "| |/\| | | '_ \  |______| | |    / _` | | | | '_ \ / __| '_ \ / _ \ '__|"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1804
ECHO "\  /\  / | | | |          | |___| (_| | |_| | | | | (__| | | |  __/ |   "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1805
ECHO " \/  \/|_|_| |_|          \_____/\__,_|\__,_|_| |_|\___|_| |_|\___|_|   "
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1806
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1807
ECHO Author:   Patrik Svestka
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1808
ECHO Contact: "patrik.svestka|dot|gmail<dot>com"
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1809
ECHO Alias:    tukanos
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1810
ECHO You can find me at: Bitbucket(https://bitbucket.org/-tukanos-/) or github (https://github.com/tukanos/)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1811
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1812
ECHO License:  MIT License (more at https://opensource.org/licenses/MIT)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1813
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1814
ECHO Versions: The %~nx0 executed is at version: "=>%~1<="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1815
ECHO           Smalltalk/X is at version: "=>%~2<="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1816
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1817
ECHO Special thanks:   Jan Vrany         - for Smalltalk and VM support during writing of this script
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1818
ECHO                   Claus Gittinger   - for creating all Smalltalk/X environment
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1819
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1820
ECHO                   Rob van der Woude - for having great pages about batch files  (http://http://www.robvanderwoude.com)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1821
ECHO                   Simon Sheppard - for having great catalog at (https://ss64.com/nt/)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1822
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1823
ECHO This script was tested on: Windows 7 SP1 x64 (enterprise), Windows XP SP3 x86 (stx-bin),
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1824
ECHO                            Windows 10 Pro (10.0.14393), (thanks Jan), Window 2008 R2 SP1 x64 (enterprise)
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1825
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1826
ECHO Short description: This file enables you to run stx(-bin).com(exe) with additional features like:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1827
ECHO Logging, quick start, starting via image (default or with user interaction), etc.
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1828
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1829
ECHO To find out more on how to run this .bat file with --help-launcher switch
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1830
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1831
GOTO :EOF
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1832
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1833
:: =================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1834
:: Version section =
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1835
:: =================
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1836
:stx_version
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1837
ECHO The %~nx0 executed is at version: "=>%~1<="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1838
ECHO:
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1839
ECHO Smalltalk/X is at version: "=>%~2<="
09ca0f1d4e64 Win32: export `STX_PACKAGEPATH` when running from "install" tree
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1520
diff changeset
  1840
1514
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1841
GOTO :EOF
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1842
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1843
:: *******************************************************************************************
4bdcdc52e55a Windows launcher improvement - starting is still done via smalltalk.bat
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1508
diff changeset
  1844
:: End                                                                                       *
1537
c9aea063a34e Issue: #172 StX fails to start on Windows when launcher script is run from different directory
Patrik Svestka <patrik.svestka@gmail.com>
parents: 1527
diff changeset
  1845
:: *******************************************************************************************