|
|
|
|
@ -432,21 +432,27 @@ SETLOCAL EnableDelayedExpansion
|
|
|
|
|
@REM batch file library functions |
|
|
|
|
@GOTO :endlib |
|
|
|
|
|
|
|
|
|
@REM padding |
|
|
|
|
@REM padding |
|
|
|
|
@REM padding |
|
|
|
|
@REM padding |
|
|
|
|
@REM padding xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
|
|
|
@REM padding xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
|
|
|
|
|
|
|
|
%= ---------------------------------------------------------------------- =% |
|
|
|
|
@rem courtesy of dbenham |
|
|
|
|
:: Example usage |
|
|
|
|
@rem call :getUniqueFile "d:\test\myFile" ".txt" myFile |
|
|
|
|
@rem echo myFile="%myFile%" |
|
|
|
|
|
|
|
|
|
@rem 2025 - wmic deprecated :/ |
|
|
|
|
@rem 2025 - output of 'wmic os get localDateTime' was something like: |
|
|
|
|
@rem LocalDateTime |
|
|
|
|
@rem 20251015234316.777000+660 |
|
|
|
|
@rem !time! has a resolution of centiseconds. As we test in a loop for file existence, that should be ok. |
|
|
|
|
:getUniqueFile baseName extension rtnVar |
|
|
|
|
setlocal |
|
|
|
|
setlocal enabledelayedexpansion |
|
|
|
|
:getUniqueFileLoop |
|
|
|
|
for /f "skip=1" %%A in ('wmic os get localDateTime') do for %%B in (%%A) do set "rtn=%~1_%%B%~2" |
|
|
|
|
set "r=!date!_!time!" |
|
|
|
|
set "r=%r::=.%" |
|
|
|
|
set "r=%r: =%" |
|
|
|
|
set "rtn=%~1_!r!%~2" |
|
|
|
|
echo "### %rtn%" |
|
|
|
|
if exist "%rtn%" ( |
|
|
|
|
goto :getUniqueFileLoop |
|
|
|
|
) else ( |
|
|
|
|
@ -454,6 +460,7 @@ if exist "%rtn%" (
|
|
|
|
|
) |
|
|
|
|
endlocal & set "%~3=%rtn%" |
|
|
|
|
exit /b |
|
|
|
|
|
|
|
|
|
%= ---------------------------------------------------------------------- =% |
|
|
|
|
|
|
|
|
|
@REM padding |
|
|
|
|
@ -1389,7 +1396,7 @@ case "$1" in
|
|
|
|
|
;; |
|
|
|
|
"list") |
|
|
|
|
if [[ -d "$archdir" ]]; then |
|
|
|
|
echo "$(ls $archdir -1 | wc -l) files in $archdir" |
|
|
|
|
echo "$(ls $archdir -1 | grep -v '_BUILDCOPY$' | wc -l) files in $archdir" |
|
|
|
|
echo $(ls $archdir -1) |
|
|
|
|
else |
|
|
|
|
echo -e "No runtimes available in $archdir\n Use '$0 fetch' to install." |
|
|
|
|
@ -1397,7 +1404,7 @@ case "$1" in
|
|
|
|
|
;; |
|
|
|
|
"run") |
|
|
|
|
#todo - lookup active runtime for os-arch from .toml file |
|
|
|
|
activeruntime=$(ls $archdir -1 | tail -n 1) |
|
|
|
|
activeruntime=$(ls $archdir -1 | grep -v '_BUILDCOPY$' | tail -n 1) |
|
|
|
|
activeruntime_fullpath="$archdir/$activeruntime" |
|
|
|
|
#echo "using $activeruntime_fullpath" |
|
|
|
|
shift |
|
|
|
|
@ -1960,7 +1967,7 @@ function psmain {
|
|
|
|
|
if (-not(Test-Path -Path $archfolder -PathType Container)) { |
|
|
|
|
write-host "No runtimes seem to be installed for $arch`nPlease use 'runtime.cmd fetch' to install" |
|
|
|
|
} else { |
|
|
|
|
$dircontents = (get-childItem -Path $archfolder -File | Sort-Object Name) |
|
|
|
|
$dircontents = (get-childItem -Path $archfolder -File | where-object Name -Notlike '*_BUILDCOPY.*' | Sort-Object Name) |
|
|
|
|
if ($dircontents.Count -gt 0) { |
|
|
|
|
#write-host "run.." |
|
|
|
|
write-host "num params: $($PSBoundParameters.opts.count)" |
|
|
|
|
@ -2033,7 +2040,7 @@ function psmain {
|
|
|
|
|
|
|
|
|
|
$localdict = @{} |
|
|
|
|
if (test-path -Path $archfolder -Type Container) { |
|
|
|
|
$dircontents = (get-childItem -Path $archfolder -File | Where-object {-not ($(".txt",".tm") -contains $_.Extension) }) |
|
|
|
|
$dircontents = (get-childItem -Path $archfolder -File | Where-object Name -Notlike '*_BUILDCOPY.*' | Where-object {-not ($(".txt",".tm") -contains $_.Extension) }) |
|
|
|
|
foreach ($f in $dircontents) { |
|
|
|
|
$local_sha1 = Get-FileHash -Path $(${f}.FullName) -Algorithm SHA1 |
|
|
|
|
$localdict[$f.Name] = ${local_sha1}.Hash |
|
|
|
|
@ -2086,7 +2093,7 @@ function psmain {
|
|
|
|
|
if (test-path -Path $archfolder -Type Container) { |
|
|
|
|
Write-host "-----------------------------------------------------------------------" |
|
|
|
|
Write-Host "Local runtimes for $arch" |
|
|
|
|
$dircontents = (get-childItem -Path $archfolder -File | Where-object {-not ($(".txt",".tm") -contains $_.Extension) }) |
|
|
|
|
$dircontents = (get-childItem -Path $archfolder -File | Where-object Name -Notlike '*_BUILDCOPY.*' | Where-object {-not ($(".txt",".tm") -contains $_.Extension) }) |
|
|
|
|
write-host "$(${dircontents}.count) files in $archfolder" |
|
|
|
|
Write-host "-----------------------------------------------------------------------" |
|
|
|
|
foreach ($f in $dircontents) { |
|
|
|
|
@ -2163,3 +2170,4 @@ no script engine should try to run me
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|