Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
humbletim committed Sep 26, 2024
1 parent 438a1b3 commit d08d6b0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
19 changes: 13 additions & 6 deletions gha-generate-shell-env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -Euo pipefail

_PRESHELL_PATH="${_PRESHELL_PATH:-}"
_SYSTEM_PATH="${PATH:-}"
PATH="$PATH:/usr/bin"

gha_fsvr_dir="$(dirname "${BASH_SOURCE}")"
Expand All @@ -23,7 +24,13 @@ else
_PYTHONUSERBASE="$(readlink -f bin/pystuff)"
fi

pysite="$(PYTHONUSERBASE="$_PYTHONUSERBASE" python3 -msite --user-site)"
python3="$(PATH="$PATH:$_PRESHELL_PATH" which python3)"
$python3 --version >/dev/null || { echo "!python3" 2>&1 ; exit 26 ; }

jqexe="$(PATH="$_SYSTEM_PATH:$_PRESHELL_PATH" which jq)"
$jqexe --version >/dev/null || { which jq ; echo "!jq" 2>&1 ; exit 27 ; }

pysite="$(PYTHONUSERBASE="$_PYTHONUSERBASE" ${python3} -msite --user-site)"

######################################################################
echo "$(cat<<EOF
Expand Down Expand Up @@ -53,20 +60,20 @@ function _err() { local rc=\$1 ; shift; echo "[_err rc=\$rc] \$@" >&2; return \$
function ht-ln() {( source "$ghash/gha.ht-ln.bash" && ht-ln "\$@" )}
function hostname(){ echo '$_hostname' ; }
function tee() { TEE="`which tee`" "`which python3`" "$gha_fsvr_dir/util/tee.py" "\$@" ; }
function tee() { TEE="`which tee`" "${python3}" "$gha_fsvr_dir/util/tee.py" "\$@" ; }
function colout() { $(
if which colout 2>/dev/null > /dev/null ; then
if PATH="$_SYSTEM_PATH" which colout 2>/dev/null > /dev/null ; then
echo \"`which colout`\"
else
echo \"`which python3`\" \"$pysite/colout/colout.py\"
echo \"${python3}\" \"$pysite/colout/colout.py\"
fi
) "\$@" ; }
function parallel() { PARALLEL_SHELL="$BASH" PARALLEL_HOME="$PWD/bin/parallel-home" "`which perl`" "$PWD/bin/parallel" "\$@" ; }
function jq() { "`which jq`" $(
function jq() { "${jqexe}" $(
# grr... detect if jq supports -b (binary)
# otherwise... fall back to tr -d '\r' workaround
# TODO: jq.exe also croaks if jq 'filter\r' contains LFs...
jq -ben 1 2>/dev/null > /dev/null
${jqexe} -ben 1 2>/dev/null > /dev/null
if [[ $? == 0 ]] ; then
echo '-b "$@"'
else
Expand Down
25 changes: 10 additions & 15 deletions util/load_with_settings_and_cache_here.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
REM launch firestorm with os-level settings and cache locations
REM --humbletim 2024.03.08
REM %~dp0 == path of this batch file
REM %* forwards any arguments alonge; eg:
REM launch_with_settings_and_cache_here.bat --set UIScaleFactor 1

REM new Firestorm_x64 user settings location
@echo off
REM | launch viewer with in-folder APPDATA (user settings) LOCALAPPDATA (cache, logs, etc.)
REM | ... for FS this will emerge ./Firestorm_x64 and ./FirestormOS_x64 respectively
REM | --humbletim 2024.03.08
REM |
REM | %* forwards any arguments alonge; eg:
REM | launch_with_settings_and_cache_here.bat --set UIScaleFactor 1
REM | %~dp0 == path of this batch file

set "APPDATA=%~dp0"

REM new FirestormOS_x64 cache/temp location

set "LOCALAPPDATA=%~dp0"

REM actual .exe name to launch
REM use an absolute path unless in same folder as this batch file

call $APPLICATION_EXE %*
echo APPDATA=%APPDATA% LOCALAPPDATA=%LOCALAPPDATA%
call %~dp0\$APPLICATION_EXE %*

0 comments on commit d08d6b0

Please sign in to comment.