Add a function for removing desktop icons
This commit is contained in:
parent
18b1ae071c
commit
32030e1455
4 changed files with 7 additions and 3 deletions
|
@ -24,6 +24,10 @@ class Context {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[void] RemoveDesktopIcon($pattern) {
|
||||||
|
Remove-Item "$env:PUBLIC/Desktop/$pattern";
|
||||||
|
}
|
||||||
|
|
||||||
[Microsoft.Win32.RegistryKey] EnsureConfigKey() {
|
[Microsoft.Win32.RegistryKey] EnsureConfigKey() {
|
||||||
if (-not (Test-Path $this.ConfigRoot)) {
|
if (-not (Test-Path $this.ConfigRoot)) {
|
||||||
$null = New-Item $this.ConfigRoot;
|
$null = New-Item $this.ConfigRoot;
|
||||||
|
|
|
@ -24,7 +24,7 @@ $null = New-Module {
|
||||||
Write-Information "Installing TrackMania Nations Forever";
|
Write-Information "Installing TrackMania Nations Forever";
|
||||||
winget install --accept-source-agreements --accept-package-agreements -e --id Nadeo.TrackManiaNationsForever;
|
winget install --accept-source-agreements --accept-package-agreements -e --id Nadeo.TrackManiaNationsForever;
|
||||||
Write-Information "Removing Desktop Icon";
|
Write-Information "Removing Desktop Icon";
|
||||||
Remove-Item "$env:PUBLIC\Desktop\*TmNationsForever*";
|
$context.RemoveDesktopIcon("*TmNationsForever");
|
||||||
Write-Information "Restoring Files";
|
Write-Information "Restoring Files";
|
||||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ $null = New-Module {
|
||||||
Write-Information "Installing TrackMania United Forever";
|
Write-Information "Installing TrackMania United Forever";
|
||||||
Start-Process -Wait -FilePath $setupFile -ArgumentList @("/Silent");
|
Start-Process -Wait -FilePath $setupFile -ArgumentList @("/Silent");
|
||||||
Write-Information "Removing desktop icon";
|
Write-Information "Removing desktop icon";
|
||||||
Remove-Item "$env:PUBLIC\Desktop\*TmUnitedForever*";
|
$context.RemoveDesktopIcon("*TmUnitedForever*");
|
||||||
Write-Information "Restoring files";
|
Write-Information "Restoring files";
|
||||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||||
Pop-Location;
|
Pop-Location;
|
||||||
|
|
|
@ -19,7 +19,7 @@ $null = New-Module {
|
||||||
Write-Host "Restoring osu!";
|
Write-Host "Restoring osu!";
|
||||||
Write-Information "Installing osu!";
|
Write-Information "Installing osu!";
|
||||||
choco install -y osu;
|
choco install -y osu;
|
||||||
Remove-Item "$env:PUBLIC\Desktop\*osu*";
|
$context.RemoveDesktopIcon("*osu*");
|
||||||
Write-Information "Restoring files";
|
Write-Information "Restoring files";
|
||||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||||
$configName = "osu!.$env:USERNAME.cfg";
|
$configName = "osu!.$env:USERNAME.cfg";
|
||||||
|
|
Loading…
Reference in a new issue