|
| 1 | +@echo off |
| 2 | + |
| 3 | +echo Making femto files... |
| 4 | + |
| 5 | +setlocal enabledelayedexpansion |
| 6 | + |
| 7 | +:: Input and output folders |
| 8 | +set "helpInFolder=.\help" |
| 9 | +set "helpOutFolder=.\help-femto" |
| 10 | +set "vlInFolder=." |
| 11 | +set "vlOutFolder=.\vl-femto" |
| 12 | + |
| 13 | +:: Create output folder if it doesn't exist |
| 14 | +if not exist "%helpOutFolder%" ( |
| 15 | + mkdir "%helpOutFolder%" |
| 16 | +) |
| 17 | + |
| 18 | +if not exist "%vlOutFolder%" ( |
| 19 | + mkdir "%vlOutFolder%" |
| 20 | +) |
| 21 | + |
| 22 | +:: Loop through all .vl files and change references |
| 23 | +for %%f in ("%helpInFolder%\*.vl") do ( |
| 24 | + set "filename=%%~nxf" |
| 25 | + powershell -NoProfile -Command ^ |
| 26 | + "$text = Get-Content -Raw '%%f';" ^ |
| 27 | + "$text = $text -replace 'Location=\"VL.Devices.AzureKinect\"', 'Location=\"VL.Devices.AzureKinect.Femto\"';" ^ |
| 28 | + "Set-Content -Encoding UTF8 '%helpOutFolder%\!filename!' $text" |
| 29 | +) |
| 30 | + |
| 31 | +:: Loop through all .vl files and change references |
| 32 | +for %%f in ("%vlInFolder%\*.vl") do ( |
| 33 | + set "filename=%%~nxf" |
| 34 | + |
| 35 | + rem Default newname |
| 36 | + set "newname=" |
| 37 | + |
| 38 | + rem Check if the filename ends with .HDE.vl |
| 39 | + if /I "!filename:~-7!"==".HDE.vl" ( |
| 40 | + rem Remove the last 7 characters (.HDE.vl) and append .Femto.HDE.vl |
| 41 | + set "base=!filename:~0,-7!" |
| 42 | + set "newname=!base!.Femto.HDE.vl" |
| 43 | + ) else ( |
| 44 | + rem Remove the last 3 characters (.vl) and append .Femto.vl |
| 45 | + set "base=!filename:~0,-3!" |
| 46 | + set "newname=!base!.Femto.vl" |
| 47 | + ) |
| 48 | + |
| 49 | + powershell -NoProfile -Command ^ |
| 50 | + "$text = Get-Content -Raw '%%f';" ^ |
| 51 | + "$text = $text -replace 'Location=\"VL.Devices.AzureKinect\"', 'Location=\"VL.Devices.AzureKinect.Femto\"';" ^ |
| 52 | + "Set-Content -Encoding UTF8 '%vlOutFolder%\!newname!' $text" |
| 53 | +) |
| 54 | + |
| 55 | +echo Done. |
| 56 | +pause |
0 commit comments