From bba9925553c91abedd41fa0d0a9e6648d7668949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20H=C3=BCbner?= Date: Wed, 11 Dec 2019 20:24:59 +0100 Subject: [PATCH] improve build script and update shortcut path --- build.ps1 | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/build.ps1 b/build.ps1 index e4fcdc1..b73847c 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,20 +1,30 @@ $buildPath = 'C:\SeeSharp\win10\x64' -$pagesPath = Join-Path -Path $buildPath -ChildPath '\pages' +$documentsPath = [Environment]::GetFolderPath("MyDocuments") +$pagesPath = Join-Path $documentsPath -ChildPath SeeSharp | Join-Path -ChildPath pages +Write-Host $pagesPath -ForegroundColor Green + +#exit ### build App -Write-Host "BUILDING APP" -ForegroundColor Green +Write-Host "================= BUILDING APP =================" -ForegroundColor Green cd SeeSharp.Desktop dotnet publish -o $buildPath -c RELEASE -f netcoreapp3.0 -r win10-x64 /p:PublishSingleFile=true /p:IncludeSymbolsInSingleFile=true cd .. ### Create 'Send to > SeeSharp' shortcut -Write-Host "CREATING 'Send to > SeeSharp' SHORTCUT" -ForegroundColor Green +Write-Host "==== CREATING 'Send to > SeeSharp' SHORTCUT ====" -ForegroundColor Green $wshshell = New-Object -com wscript.shell $shortcutPath = Join-Path -Path $wshshell.SpecialFolders.Item('sendto') -ChildPath 'SeeSharp.lnk' -$shortcut = $wshshell.CreateShortcut($shortcutPath) -$shortcut.TargetPath = $pagesPath -$shortcut.Description = 'this shortcut was created by SeeSharp' -$shortcut.Save() +if((Test-Path $shortcutPath)){ + Write-Host " shortcut already set" -ForegroundColor Green +} +else{ + $shortcut = $wshshell.CreateShortcut($shortcutPath) + $shortcut.TargetPath = $pagesPath + $shortcut.Description = 'this shortcut was created by SeeSharp' + $shortcut.Save() + Write-Host " shortcut created" -ForegroundColor Green +} -Write-Host "ALL DONE!" -ForegroundColor Green \ No newline at end of file +Write-Host "================== ALL DONE! ===================" -ForegroundColor Green \ No newline at end of file