This repository has been archived by the owner on Feb 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 342
Fix bash arg quoting, remove bash/batch shortcuts on uninstall #258
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ param( | |
$path = $path.ToLower().Replace($nugetPath.ToLower(), "%DIR%..\").Replace("\\","\") | ||
$pathBash = $path.Replace("%DIR%..\","`$DIR/../").Replace("\","/") | ||
Write-Host "Adding $packageBatchFileName and pointing to `'$path`'." -ForegroundColor $Note | ||
Write-Host "Adding $packageBashFileName and pointing to `'$path`'." -ForegroundColor $Note | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this line, because the existing code seemed inconsistent (it displays a message about the batch file, but not about the bash file) |
||
if ($useStart) { | ||
Write-Host "Setting up $name as a non-command line application." -ForegroundColor $Note | ||
"@echo off | ||
|
@@ -19,7 +20,7 @@ start """" ""$path"" %*" | Out-File $packageBatchFileName -encoding ASCII | |
|
||
"#!/bin/sh | ||
DIR=`${0%/*} | ||
""$pathBash"" `$* &" | Out-File $packageBashFileName -encoding ASCII | ||
""$pathBash"" ""`$*"" &" | Out-File $packageBashFileName -encoding ASCII | ||
|
||
} else { | ||
"@echo off | ||
|
@@ -28,6 +29,6 @@ SET DIR=%~dp0% | |
|
||
"#!/bin/sh | ||
DIR=`${0%/*} | ||
""$pathBash"" `$*" | Out-File $packageBashFileName -encoding ASCII | ||
""$pathBash"" ""`$*""" | Out-File $packageBashFileName -encoding ASCII | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function Remove-BinFile { | ||
param( | ||
[string] $name, | ||
[string] $path | ||
) | ||
Write-Debug "Running 'Remove-BinFile' for $name with path:`'$path`'"; | ||
|
||
$packageBatchFileName = Join-Path $nugetExePath "$name.bat" | ||
$packageBashFileName = Join-Path $nugetExePath "$name" | ||
$path = $path.ToLower().Replace($nugetPath.ToLower(), "%DIR%..\").Replace("\\","\") | ||
$pathBash = $path.Replace("%DIR%..\","`$DIR/../").Replace("\","/") | ||
Write-Debug "Attempting to remove the batch and bash shortcuts: $packageBatchFileName and $packageBashFileName" | ||
if (Test-Path $packageBatchFileName) { | ||
Write-Host "Removing batch file $packageBatchFileName which pointed to `'$path`'." -ForegroundColor $Note | ||
Remove-Item $packageBatchFileName | ||
} | ||
else { | ||
Write-Host "Tried to remove batch file $packageBatchFileName but it was already removed." -ForegroundColor $Note | ||
} | ||
if (Test-Path $packageBashFileName) { | ||
Write-Host "Removing bash file $packageBashFileName which pointed to `'$path`'." -ForegroundColor $Note | ||
Remove-Item $packageBashFileName | ||
} | ||
else { | ||
Write-Host "Tried to remove bash file $packageBashFileName but it was already removed." -ForegroundColor $Note | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line isn't strictly necessary, but I think I like it when a status message is shown when destructive changes are made.