- Backup and restore for Spotify.exe
 - Removing legacy code
This commit is contained in:
amd64fox
2022-05-16 17:05:08 +03:00
parent 99caa61d4f
commit 83d7972a98
3 changed files with 11 additions and 17 deletions

View File

@@ -641,10 +641,12 @@ $update_test_exe = Test-Path -Path $spotifyExecutable
if ($block_update) {
if ($update_test_exe) {
$exe = "$env:APPDATA\Spotify\spotify.exe"
$exe = "$env:APPDATA\Spotify\Spotify.exe"
$exe_bak = "$env:APPDATA\Spotify\Spotify.bak"
$ANSI = [Text.Encoding]::GetEncoding(1251)
$old = [IO.File]::ReadAllText($exe, $ANSI)
if ($old -match "(?<=wg:\/\/desktop-update\/.)2(\/update)") {
copy-Item $exe $exe_bak
$new = $old -replace "(?<=wg:\/\/desktop-update\/.)2(\/update)", '7/update'
[IO.File]::WriteAllText($exe, $new, $ANSI)
}

View File

@@ -798,10 +798,12 @@ $update_test_exe = Test-Path -Path $spotifyExecutable
if ($block_update) {
if ($update_test_exe) {
$exe = "$env:APPDATA\Spotify\spotify.exe"
$exe = "$env:APPDATA\Spotify\Spotify.exe"
$exe_bak = "$env:APPDATA\Spotify\Spotify.bak"
$ANSI = [Text.Encoding]::GetEncoding(1251)
$old = [IO.File]::ReadAllText($exe, $ANSI)
if ($old -match "(?<=wg:\/\/desktop-update\/.)2(\/update)") {
copy-Item $exe $exe_bak
$new = $old -replace "(?<=wg:\/\/desktop-update\/.)2(\/update)", '7/update'
[IO.File]::WriteAllText($exe, $new, $ANSI)
}

View File

@@ -11,6 +11,11 @@ if exist "%Appdata%\Spotify\chrome_elf_bak.dll" (
move "%Appdata%\Spotify\chrome_elf_bak.dll" "%Appdata%\Spotify\chrome_elf.dll" > NUL 2>&1
)
if exist "%Appdata%\Spotify\Spotify.bak" (
del /s /q "%Appdata%\Spotify.exe" > NUL 2>&1
move "%Appdata%\Spotify\Spotify.bak" "%Appdata%\Spotify\Spotify.exe" > NUL 2>&1
)
if exist "%Appdata%\Spotify\config.ini" (
del /s /q "%Appdata%\Spotify\config.ini" > NUL 2>&1
@@ -33,21 +38,6 @@ if exist "%Appdata%\Spotify\blockthespot_log.txt" (
del /s /q "%Appdata%\Spotify\blockthespot_log.txt" > NUL 2>&1
)
if exist "%localappdata%\Spotify\Update" (
del /A:sr %localappdata%\Spotify\Update > NUL 2>&1
)
if exist "%Appdata%\Spotify\SpotifyMigrator.bak" (
rename %Appdata%\Spotify\SpotifyMigrator.bak SpotifyMigrator.exe > NUL 2>&1
)
if exist "%Appdata%\Spotify\SpotifyMigrator.exe" (
if exist "%Appdata%\Spotify\SpotifyMigrator.bak" (
del /f /s /q %Appdata%\Spotify\SpotifyMigrator.bak > NUL 2>&1
)
)
if exist "%Appdata%\Spotify\cache" (
rd /s /q %Appdata%\Spotify\cache > NUL 2>&1