diff --git a/README.md b/README.md index 1c1786a..38722e7 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,7 @@ rootAVD.bat system-images\android-25\google_apis_playstore\armeabi-v7a\ramdisk.i ### ANDROID_HOME * Default location can be overwritten by setting the `ANDROID_HOME` variable * In both cases, the script will search in it for AVD system-images and adb binarys +* `ANDROID_HOME` Sets the path to the SDK installation directory -> [AOSP Variables reference](https://developer.android.com/tools/variables#envar) ### Notes for Apk Developers * [How-To SU](http://su.chainfire.eu) from [Chainfire's](https://github.com/Chainfire) [libsuperuser](https://github.com/Chainfire/libsuperuser) - Guidelines for problem-free su usage (for Android Developers) @@ -370,6 +371,10 @@ rootAVD.bat system-images\android-25\google_apis_playstore\armeabi-v7a\ramdisk.i ### Change Logs +#### [July 2023] +* [rootAVD.bat] - Fixed some errors with double spaces +* [rootAVD.bat] - Added TestADBWORKDIR routine + #### [June 2023] * [rootAVD.sh] - improved finding BusyBox routine, and once again * [rootAVD.sh] - rewritten the file and folder handling entirely, Darwin and Linux diff --git a/rootAVD.bat b/rootAVD.bat index 12a4446..90d96f9 100644 --- a/rootAVD.bat +++ b/rootAVD.bat @@ -42,7 +42,7 @@ IF NOT %InstallApps% ( call :ShowHelpText && exit /B 0 ) IF NOT exist "%ANDROIDHOME%%1" ( - call :ShowHelpText && exit /B 0 + echo file %1 not found && exit /B 0 ) ) @@ -83,6 +83,8 @@ set ADBWORKDIR=/data/data/com.android.shell set ADBBASEDIR=%ADBWORKDIR%/Magisk echo [-] In any AVD via ADB, you can execute code without root in /data/data/com.android.shell +call :TestADBWORKDIR + REM change to ROOTAVD directory cd %ROOTAVD% @@ -160,6 +162,22 @@ IF "%ERRORLEVEL%"=="0" ( exit /B %ERRORLEVEL% +:TestADBWORKDIR +echo [*] Testing the ADB working space + SetLocal EnableDelayedExpansion + set ADBWORKS= + adb shell cd %ADBWORKDIR% > tmpFile 2>&1 + set /P ADBWORKS=Nul && ( + echo [^^!] %ADBWORKDIR% is not available + call :_Exit 2> nul + ) + echo [^^!] %ADBWORKDIR% is available + EndLocal +exit /B 0 + :ShutDownAVD SetLocal EnableDelayedExpansion set ADBPULLECHO= @@ -196,12 +214,16 @@ exit /B 0 set DST=%2 set ADBPULLECHO= - for /F "delims=" %%i in ("%SRC%") do ( - set SRC=%%~nxi + setlocal enableDelayedExpansion + for /f "delims=" %%i in ("!SRC!") do ( + endlocal & REM + set "SRC=%%~nxi" ) - for /F "delims=" %%i in ("%DST%") do ( - set DST=%%~nxi + setlocal enableDelayedExpansion + for /f "delims=" %%i in ("!DST!") do ( + endlocal & REM + set "DST=%%~nxi" ) adb pull %ADBBASEDIR%/%SRC% %2 > tmpFile 2>&1 @@ -221,12 +243,16 @@ exit /B 0 set DST=%2 set ADBPUSHECHO= - for /F "delims=" %%i in ("%SRC%") do ( - set SRC=%%~nxi + setlocal enableDelayedExpansion + for /f "delims=" %%i in ("!SRC!") do ( + endlocal & REM + set "SRC=%%~nxi" ) - for /F "delims=" %%i in ("%DST%") do ( - set DST=%%~nxi + setlocal enableDelayedExpansion + for /f "delims=" %%i in ("!DST!") do ( + endlocal & REM + set "DST=%%~nxi" ) IF "%DST%"=="" ( @@ -506,7 +532,8 @@ exit /B 0 REM set ANDROID_HOME=%USERPROFILE%\Downloads\sdk REM set ANDROID_HOME="%USERPROFILE%\Downloads\sd k" REM set ANDROID_HOME=%USERPROFILE%\Downloads\sd k - + REM set ANDROID_HOME=%USERPROFILE%\Downloads\Program Files (x86)\Android\android-sdk + REM set ANDROID_HOME="%USERPROFILE%\Downloads\Program Files (x86)\Android\android-sdk" set NoSystemImages=%true% REM Default: Looking for LOCALAPPDATA to seach AVD system-images @@ -535,7 +562,6 @@ exit /B 0 :FindSystemImages echo - use %ENVVAR% to search for AVD system images echo. - SetLocal EnableDelayedExpansion set SYSIM_EX= @@ -546,7 +572,12 @@ exit /B 0 for /f "delims=" %%i in ('dir "%ANDROIDHOME%%SYSIM_DIR%ramdisk*.img" /s /b /a-d') do ( set "j=%%~i" - set j=!j:%ANDROIDHOME%=! + setlocal enableDelayedExpansion + for /f "delims=" %%a in ("!ANDROIDHOME!") do ( + endlocal & REM + set "j=!j:%%a=!" + ) + IF %ListAllAVDs% ( IF "!SYSIM_EX!" == "" ( set SYSIM_EX=!j!