Skip to content

Instantly share code, notes, and snippets.

@glachancecmaisonneuve
Last active July 12, 2018 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glachancecmaisonneuve/639732f0196ec6b2ef85506ce2ce82ed to your computer and use it in GitHub Desktop.
Save glachancecmaisonneuve/639732f0196ec6b2ef85506ce2ce82ed to your computer and use it in GitHub Desktop.
DoNotFuckWithMyPath overrides chocolatey's Install-ChocolateyPath function (installers may still change your paths, but package maintainers can't)
function Register-DoNotFuckWithMyPath {
param(
[parameter(Mandatory=$true, Position=0)][string] $pathToInstall,
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
Write-Host "Chocolatey-DoNotFuckWithMyPath Extension prevented an overzealous package manager to from fucking with your path."
Write-Host "(It attempted to add $pathToInstall)"
}
New-Alias -Name 'Install-ChocolateyPath' -Value 'Register-DoNotFuckWithMyPath' -Scope Global
Write-Host "Chocolatey-DoNotFuckWithMyPath Extension is enabled"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment