alexmarcoo / open-in-native-client

GNU General Public License v3.0
119 stars 49 forks source link

uninstall.bat potentially removes everything in Local AppData #13

Open jhorsman opened 3 years ago

jhorsman commented 3 years ago

I think the uninstall.bat script for Windows potentially can remove everything in the Local AppData.

The intent of the script is to figure out a path and store it in %id%.

IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
  FOR /f %%i in ('..\node\x64\node.exe -e "process.stdout.write(require('./config.js').id)"') do SET id=%%i
) ELSE (
  FOR /f %%i in ('..\node\x86\node.exe -e "process.stdout.write(require('./config.js').id)"') do SET id=%%i
)

However, if uninstall.bat is ran from outside the installation directory this might fail and %id% would be empty. Therefore the following will attempt to delete everything in the Local AppData folder.

echo .. Deleting %id%
RMDIR /Q /S "%LocalAPPData%\%id%"