mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-08-10 01:51:09 +10:00
Without shortcut on desktop
- Added an incoming parameter (no_shortcut) that installs SpotX without a desktop shortcut https://github.com/amd64fox/SpotX/issues/108
This commit is contained in:
+46
-10
@@ -75,6 +75,9 @@ param
|
|||||||
#[Parameter(HelpMessage = 'Connect unlock test.')]
|
#[Parameter(HelpMessage = 'Connect unlock test.')]
|
||||||
#[switch]$testconnect,
|
#[switch]$testconnect,
|
||||||
|
|
||||||
|
[Parameter(HelpMessage = 'Do not create desktop shortcut.')]
|
||||||
|
[switch]$no_shortcut,
|
||||||
|
|
||||||
[Parameter(HelpMessage = 'Select the desired language to use for installation. Default is the detected system language.')]
|
[Parameter(HelpMessage = 'Select the desired language to use for installation. Default is the detected system language.')]
|
||||||
[Alias('l')]
|
[Alias('l')]
|
||||||
[string]$Language
|
[string]$Language
|
||||||
@@ -636,6 +639,7 @@ $chrome_elf = "$spotifyDirectory\chrome_elf.dll"
|
|||||||
$chrome_elf_bak = "$spotifyDirectory\chrome_elf_bak.dll"
|
$chrome_elf_bak = "$spotifyDirectory\chrome_elf_bak.dll"
|
||||||
$cache_folder = "$env:APPDATA\Spotify\cache"
|
$cache_folder = "$env:APPDATA\Spotify\cache"
|
||||||
$spotifyUninstall = "$env:TEMP\SpotifyUninstall.exe"
|
$spotifyUninstall = "$env:TEMP\SpotifyUninstall.exe"
|
||||||
|
$start_menu = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Spotify.lnk"
|
||||||
$upgrade_client = $false
|
$upgrade_client = $false
|
||||||
|
|
||||||
function incorrectValue {
|
function incorrectValue {
|
||||||
@@ -1062,12 +1066,14 @@ if (-not $spotifyInstalled -or $upgrade_client) {
|
|||||||
# Client installation
|
# Client installation
|
||||||
Start-Process -FilePath explorer.exe -ArgumentList $PWD\SpotifySetup.exe
|
Start-Process -FilePath explorer.exe -ArgumentList $PWD\SpotifySetup.exe
|
||||||
while (-not (get-process | Where-Object { $_.ProcessName -eq 'SpotifySetup' })) {}
|
while (-not (get-process | Where-Object { $_.ProcessName -eq 'SpotifySetup' })) {}
|
||||||
wait-process -name SpotifySetup
|
|
||||||
|
|
||||||
|
|
||||||
wait-process -name SpotifySetup
|
wait-process -name SpotifySetup
|
||||||
Stop-Process -Name Spotify
|
Stop-Process -Name Spotify
|
||||||
|
if ($no_shortcut) {
|
||||||
|
$ErrorActionPreference = 'SilentlyContinue'
|
||||||
|
$desktop_folder = DesktopFolder
|
||||||
|
Start-Sleep -Milliseconds 1000
|
||||||
|
remove-item "$desktop_folder\Spotify.lnk" -Recurse -Force
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete the leveldb folder (Fixes bug with incorrect experimental features for some accounts)
|
# Delete the leveldb folder (Fixes bug with incorrect experimental features for some accounts)
|
||||||
@@ -1152,6 +1158,7 @@ if ($cache_off) {
|
|||||||
if (Test-Path -LiteralPath $cache_folder) {
|
if (Test-Path -LiteralPath $cache_folder) {
|
||||||
remove-item $cache_folder -Recurse -Force
|
remove-item $cache_folder -Recurse -Force
|
||||||
remove-item $desktop_folder\Spotify.lnk -Recurse -Force
|
remove-item $desktop_folder\Spotify.lnk -Recurse -Force
|
||||||
|
remove-item $start_menu -Recurse -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!($cache_on) -and !($cache_off)) {
|
if (!($cache_on) -and !($cache_off)) {
|
||||||
@@ -1182,6 +1189,7 @@ if (!($cache_on) -and !($cache_off)) {
|
|||||||
if (Test-Path -LiteralPath $cache_folder) {
|
if (Test-Path -LiteralPath $cache_folder) {
|
||||||
remove-item $cache_folder -Recurse -Force
|
remove-item $cache_folder -Recurse -Force
|
||||||
remove-item $desktop_folder\Spotify.lnk -Recurse -Force
|
remove-item $desktop_folder\Spotify.lnk -Recurse -Force
|
||||||
|
remove-item $start_menu -Recurse -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1762,14 +1770,29 @@ if ($ru) {
|
|||||||
Remove-Item $patch_lang -Exclude *en*, *ru* -Recurse
|
Remove-Item $patch_lang -Exclude *en*, *ru* -Recurse
|
||||||
}
|
}
|
||||||
|
|
||||||
# Shortcut Spotify.lnk
|
# create a desktop shortcut
|
||||||
$ErrorActionPreference = 'SilentlyContinue'
|
$ErrorActionPreference = 'SilentlyContinue'
|
||||||
|
|
||||||
$desktop_folder = DesktopFolder
|
if (!($no_shortcut)) {
|
||||||
|
|
||||||
If (!(Test-Path $desktop_folder\Spotify.lnk)) {
|
$desktop_folder = DesktopFolder
|
||||||
|
|
||||||
|
If (!(Test-Path $desktop_folder\Spotify.lnk)) {
|
||||||
|
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
|
$target = "$desktop_folder\Spotify.lnk"
|
||||||
|
$WorkingDir = "$env:APPDATA\Spotify"
|
||||||
|
$WshShell = New-Object -comObject WScript.Shell
|
||||||
|
$Shortcut = $WshShell.CreateShortcut($target)
|
||||||
|
$Shortcut.WorkingDirectory = $WorkingDir
|
||||||
|
$Shortcut.TargetPath = $source
|
||||||
|
$Shortcut.Save()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# create shortcut in start menu
|
||||||
|
If (!(Test-Path $start_menu)) {
|
||||||
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
$target = "$desktop_folder\Spotify.lnk"
|
$target = $start_menu
|
||||||
$WorkingDir = "$env:APPDATA\Spotify"
|
$WorkingDir = "$env:APPDATA\Spotify"
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
$WshShell = New-Object -comObject WScript.Shell
|
||||||
$Shortcut = $WshShell.CreateShortcut($target)
|
$Shortcut = $WshShell.CreateShortcut($target)
|
||||||
@@ -1820,9 +1843,22 @@ if ($cache_install) {
|
|||||||
downloadScripts -param1 "hide_window"
|
downloadScripts -param1 "hide_window"
|
||||||
downloadScripts -param1 "run_ps"
|
downloadScripts -param1 "run_ps"
|
||||||
|
|
||||||
# Spotify.lnk
|
|
||||||
|
# create a desktop shortcut
|
||||||
|
if (!($no_shortcut)) {
|
||||||
|
$source2 = "$cache_folder\hide_window.vbs"
|
||||||
|
$target2 = "$desktop_folder\Spotify.lnk"
|
||||||
|
$WorkingDir2 = "$cache_folder"
|
||||||
|
$WshShell2 = New-Object -comObject WScript.Shell
|
||||||
|
$Shortcut2 = $WshShell2.CreateShortcut($target2)
|
||||||
|
$Shortcut2.WorkingDirectory = $WorkingDir2
|
||||||
|
$Shortcut2.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
|
$Shortcut2.TargetPath = $source2
|
||||||
|
$Shortcut2.Save()
|
||||||
|
}
|
||||||
|
# create shortcut in start menu
|
||||||
$source2 = "$cache_folder\hide_window.vbs"
|
$source2 = "$cache_folder\hide_window.vbs"
|
||||||
$target2 = "$desktop_folder\Spotify.lnk"
|
$target2 = $start_menu
|
||||||
$WorkingDir2 = "$cache_folder"
|
$WorkingDir2 = "$cache_folder"
|
||||||
$WshShell2 = New-Object -comObject WScript.Shell
|
$WshShell2 = New-Object -comObject WScript.Shell
|
||||||
$Shortcut2 = $WshShell2.CreateShortcut($target2)
|
$Shortcut2 = $WshShell2.CreateShortcut($target2)
|
||||||
|
|||||||
Reference in New Issue
Block a user