Issue: #172 StX fails to start on Windows when launcher script is run from different directory jv
authorPatrik Svestka <patrik.svestka@gmail.com>
Wed, 10 Jan 2018 14:37:22 +0100
branchjv
changeset 1537 c9aea063a34e
parent 1536 e42b1ef2bc0c
child 1538 29c49741019b
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.
smalltalk.bat
--- a/smalltalk.bat	Fri Dec 29 19:54:20 2017 +0000
+++ b/smalltalk.bat	Wed Jan 10 14:37:22 2018 +0100
@@ -1,17 +1,17 @@
 @ECHO OFF
 
-::  _____                 _ _ _        _ _         ____   __
-:: /  ___|               | | | |      | | |       / /\ \ / /
-:: \ `--. _ __ ___   __ _| | | |_ __ _| | | __   / /  \ V /
-::  `--. \ '_ ` _ \ / _` | | | __/ _` | | |/ /  / /   /   \
-:: /\__/ / | | | | | (_| | | | || (_| | |   <  / /   / /^\ \
-:: \____/|_| |_| |_|\__,_|_|_|\__\__,_|_|_|\_\/_/    \/   \/
-::
-::  _    _ _                  _                            _
-:: | |  | (_)                | |                          | |
-:: | |  | |_ _ __    ______  | |     __ _ _   _ _ __   ___| |__   ___ _ __
+::  _____                 _ _ _        _ _         ____   __               
+:: /  ___|               | | | |      | | |       / /\ \ / /               
+:: \ `--. _ __ ___   __ _| | | |_ __ _| | | __   / /  \ V /                
+::  `--. \ '_ ` _ \ / _` | | | __/ _` | | |/ /  / /   /   \                
+:: /\__/ / | | | | | (_| | | | || (_| | |   <  / /   / /^\ \               
+:: \____/|_| |_| |_|\__,_|_|_|\__\__,_|_|_|\_\/_/    \/   \/               
+::                                                                         
+::  _    _ _                  _                            _               
+:: | |  | (_)                | |                          | |              
+:: | |  | |_ _ __    ______  | |     __ _ _   _ _ __   ___| |__   ___ _ __ 
 :: | |/\| | | '_ \  |______| | |    / _` | | | | '_ \ / __| '_ \ / _ \ '__|
-:: \  /\  / | | | |          | |___| (_| | |_| | | | | (__| | | |  __/ |
+:: \  /\  / | | | |          | |___| (_| | |_| | | | | (__| | | |  __/ |   
 ::  \/  \/|_|_| |_|          \_____/\__,_|\__,_|_| |_|\___|_| |_|\___|_|
 
 :: ==================================
@@ -41,7 +41,7 @@
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -55,11 +55,7 @@
 :: This script
 SET batch_script_version=1.5.1
 :: Smalltalk/X
-SET stx_version_default=6.2.6
-:: Do not change following line, $STX_VERSION_DEFAULT serves
-::as placeholder and it's being replaced during installation
-:: process (`rake install`)
-SET stx_version="!stx_version_default!"
+SET stx_version=6.2.6
 
 :: ====================
 :: Comments and style =
@@ -124,12 +120,12 @@
     REM No color as expansion is not yet enabled
     ECHO "Unable to enable extensions.  Fix it."
     SET exit_value=1
-    GOTO exit_sequence
+    GOTO exit_sequence 
 )
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -170,7 +166,7 @@
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 :: =============
@@ -181,12 +177,12 @@
     ECHO:
     ECHO "[INFO] Start timer. START at: !__start! [seconds]"
     ECHO:
-
+    
 )
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 :: To see stx. namespace uncomment below
@@ -204,7 +200,7 @@
     CALL :expand_path !stx.stx_bin_dir! stx.stx_bin_dir
     IF ERRORLEVEL 1 (
         ECHO "[ERROR] -> stx.stx_bin_dir <- variable error in  check your configuration file -> !stx.stx_bin_dir! <-"
-        GOTO :EOF
+        GOTO :EOF 
     )
 )
 
@@ -215,7 +211,7 @@
     CALL :expand_path !stx.image_path! stx.image_path
     IF ERRORLEVEL 1 (
         ECHO "[ERROR] -> stx.image_path <- variable error in  check your configuration file -> !stx.image_path! <-"
-        GOTO :EOF
+        GOTO :EOF 
     )
 )
 
@@ -226,7 +222,7 @@
     CALL :expand_path !stx.log_directory! stx.log_directory
     IF ERRORLEVEL 1 (
         ECHO "[ERROR] -> stx.log_directory <- variable error in  check your configuration file -> !stx.log_directory! <-"
-        GOTO :EOF
+        GOTO :EOF 
     )
 )
 
@@ -269,7 +265,7 @@
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -283,7 +279,7 @@
 CALL :powershell_detection __binary.powershell_detected PowerShellVersion RuntimeVersion
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -362,7 +358,7 @@
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -508,7 +504,7 @@
     )
     REM clearing temp variable
     SET correct_substring=
-
+    
     REM ===========================================================================================
     REM Checking string's end to contain either backslash and double quotes or just double quotes =
     REM ===========================================================================================
@@ -640,7 +636,7 @@
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -668,7 +664,6 @@
     SET "stx_home=!stx.stx_bin_dir:"=!.."
     SET "stx_topdir=!stx.stx_bin_dir:"=!..\lib\smalltalkx\!stx_version!"
     SET "stx_libdir=!stx.stx_bin_dir:"=!..\lib\smalltalkx\!stx_version!\lib"
-    SET "stx_packagepath=!stx.stx_bin_dir:"=!..\lib\smalltalkx\!stx_version!\packages"
     SET "smalltalk_executable=!stx.stx_bin_dir:"=!!selected_executable!"
 ) ELSE IF EXIST "stx.com" (
      IF "!stx.__binary.run_via_shell!" EQU "TRUE" (
@@ -729,7 +724,7 @@
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -924,7 +919,7 @@
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -954,7 +949,7 @@
 :: An alternative working too
 REM START /B /W !exec_command$!
 
-:: An alternatives NOT working properly (for unknown reason) - as a warning
+:: An alternatives NOT working properly (for unknown reason) - as a warning 
 REM ECHO " "exec: !%exec_command%!"
 REM CALL %%exec_command%%
 
@@ -1006,7 +1001,7 @@
 
 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:: Next section follows
+:: Next section follows 
 :: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -1042,7 +1037,7 @@
     FOR /F "tokens=1 delims==" %%V IN ('SET stx. 2^>NUL') DO (
         SET %%V=
     )
-
+    
     call :cleanupColorPrint
     REM Deallocate variables
     ENDLOCAL
@@ -1170,7 +1165,7 @@
 
 :: %%A - double %% due to FOR loop and %A as an array
 :: within FOR filename with suffix: %%~nxA
-:: 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
+:: 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 
 :: However, the '|| REM' trick captures the ERRORLEVEL from the DIR executed as for command.
 :: -DN - order by date (the newest first) and in alphabetic order
 ECHO "--------------- User input ------------------------------------------------------------------------------------"
@@ -1452,7 +1447,7 @@
 
 
 REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-REM Next section follows
+REM Next section follows 
 REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -1517,7 +1512,7 @@
 ECHO: ===================
 ECHO Stx bin directory =
 ECHO ===================
-ECHO Setting: stx_bin_dir -
+ECHO Setting: stx_bin_dir - 
 ECHO Impact: defines the directory containing the executable
 ECHO Note: do not forget the last backslash ^(\^) and double quotes when changing to custom path
 ECHO stx_bin_dir="%~dp0"
@@ -1573,7 +1568,7 @@
 ECHO Setting: __binary.append_to_log
 ECHO Impact: Appends the log file.  Uses a PowerShell when appending.
 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)
-ECHO TRUE - if log file is found it will be appended.  If not a new one will be created
+ECHO TRUE - if log file is found it will be appended.  If not a new one will be created 
 ECHO FALSE - the append functionality is turned off (the log file will be overwritten every time StX is executed)
 ECHO __binary.append_to_log=TRUE
 ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1710,7 +1705,7 @@
 ECHO 1) For any logging you need to have at least PowerShell 2.0
 ECHO 2) User menu searches only the log_directory.  The subdirectories are excluded from the search (doable but the script is already too complex)
 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.
-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 )
+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 ) 
 ECHO    The error can be ignored.
 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.)
 ECHO 6) When using CMD PowerShell mode manual (user) switches can not be used.  When used the batch file forces CMD only mode.
@@ -1768,8 +1763,8 @@
 REM fixes it when running from within PS but not the command prompt
 
 REM Batch file:
-REM ...cmd /c "ECHO "Hello from standard error 1>&2" 2>&1 | %{ "$_" } | tee...
-REM
+REM ...cmd /c "ECHO "Hello from standard error 1>&2" 2>&1 | %{ "$_" } | tee... 
+REM 
 
 :: " ====================="
 :: " Exiting batch files ="
@@ -1847,4 +1842,4 @@
 
 :: *******************************************************************************************
 :: End                                                                                       *
-:: *******************************************************************************************
+:: *******************************************************************************************
\ No newline at end of file