-
Notifications
You must be signed in to change notification settings - Fork 4
Fix replace.bat when CWD is wrong; alert on unknown firmware build #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Windows | ||
| Thumbs.db | ||
| ehthumbs.db | ||
| Desktop.ini |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,25 @@ | ||
| @echo off | ||
| setlocal | ||
| for /r "." %%F in (details.html) do ( | ||
| setlocal EnableDelayedExpansion | ||
| rem Always search from this script's folder. "Run as administrator" and some | ||
| rem launch methods leave the current directory as System32, so for /r "." | ||
| rem would find nothing and fail silently. | ||
| set "_root=%~dp0" | ||
| set /a _count=0 | ||
| for /r "%_root%" %%F in (details.html) do ( | ||
| if exist "%%~fF" ( | ||
| copy /y "%~dp0adbreak.html" "%%~fF" >nul | ||
| copy /y "%_root%adbreak.html" "%%~fF" >nul | ||
| if not errorlevel 1 ( | ||
| set /a _count+=1 | ||
| echo Replaced: %%~fF | ||
| ) | ||
| ) | ||
| ) | ||
| if !_count! equ 0 ( | ||
| echo No details.html files found under: | ||
| echo %_root% | ||
| echo Put replace.bat next to adbreak.html inside your copied .assets tree, then run again. | ||
|
Comment on lines
+8
to
+20
|
||
| ) else ( | ||
| echo. | ||
| echo Done. Replaced !_count! file^(s^). | ||
| ) | ||
| endlocal | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EnableDelayedExpansionisn't needed here (you never read_countinside theforblock), and it can break when%~dp0or any matched path contains!(literal exclamation marks get treated as delayed-expansion delimiters after%_root%is expanded). Consider dropping delayed expansion and using%_count%for the final summary (or enabling delayed expansion only in the narrowest scope where it's required).