Skip to content

Commit

Permalink
improve ccenhancer install script
Browse files Browse the repository at this point in the history
  • Loading branch information
aronovgj committed Aug 1, 2017
1 parent 324465a commit 936f799
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ccenhancer/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@ $unzipLocation = $(Split-Path -parent $MyInvocation.MyCommand.Definition)
$fileName = "CCEnhancer.exe"
$linkName = "CCEnhancer.lnk"


$folder = Get-ChildItem $unzipLocation | Where-Object {$_.Name -match "CCEnhancer*"}
# if upgrading. Else this is null and then it has to be checked again after upgrade.
$folder = Get-ChildItem $unzipLocation | Where-Object {$_.Name -match "CCEnhancer-.*"}
$folder = $folder.FullName

If ($folder){
If (Test-Path $folder){
Remove-Item $folder
Remove-Item $folder -Force -Recurse
}
}
Install-ChocolateyZipPackage $packageName $url $unzipLocation -Checksum {{checksum}} -ChecksumType 'sha256'

$installDir = Join-Path $unzipLocation $folder
$gui = Join-Path $installDir "CCEnhancer.exe.gui"
#if fresh install
$folder = Get-ChildItem $unzipLocation | Where-Object {$_.Name -match "CCEnhancer-.*"}
$folder = $folder.FullName

$gui = Join-Path $folder "CCEnhancer.exe.gui"
New-Item $gui -type file -force

#install start menu shortcut
$programs = [environment]::GetFolderPath([environment+specialfolder]::Programs)
$shortcutFilePath = Join-Path $programs $linkName
$targetPath = Join-Path $installDir $fileName
$targetPath = Join-Path $folder $fileName
Install-ChocolateyShortcut -shortcutFilePath $shortcutFilePath -targetPath $targetPath

0 comments on commit 936f799

Please sign in to comment.