cd /d "%~dp0..\"

del /f /q "%cd%\profile\addonStartup.json"

:: LZ4
"%~dp0mozlz4-win32.exe" -x "%cd%\profile\addonStartup.json.lz4" "%cd%\profile\addonStartup.json"

:: JJ
"%~dp0jj32upx.exe" -p -i "%cd%\profile\addonStartup.json" -o "%cd%\profile\addonStartupFIX.json"
del /f /q "%cd%\profile\addonStartup.json"

:: SED
set fixcd=%cd:\=\/%
"%~dp0sed.exe" -i "s/\/\/\/[A-Z]:.*profile/\/\/\/%fixcd%\/profile/g" "%cd%\profile\addonStartupFIX.json"
"%~dp0sed.exe" -i "s/\/\/\/[A-Z]:.*core/\/\/\/%fixcd%\/profile/g" "%cd%\profile\addonStartupFIX.json"
set fixcd=%cd:\=\\\\%
"%~dp0sed.exe" -i "s/\"[A-Z]:.*\"/\"%fixcd%\\\\profile\\\\extensions\"/g" "%cd%\profile\addonStartupFIX.json"

:: JJ
"%~dp0jj32upx.exe" -u -i "%cd%\profile\addonStartupFIX.json" -o "%cd%\profile\addonStartup.json"

:: LZ4
"%~dp0mozlz4-win32.exe" -z "%cd%\profile\addonStartup.json" "%cd%\profile\addonStartup.json.lz4"

del /f /q "%cd%\profile\addonStartupFIX.json"
del /f /q "%cd%\profile\extensions.json"

exit /b