Skip to content

Commit

Permalink
Fix make_dist.ps1 script for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Spydr06 committed Jan 28, 2023
1 parent b2b8f45 commit 99f46c8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 73 deletions.
15 changes: 12 additions & 3 deletions make-dist.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ $strip_debug_script = "strip-debug-symbols.ps1"
function Create-Shortcut {
param (
[string]$SourceExe,
[string]$Arguments,
[string]$DestinationPath
)

Write-Output "Info: Creating shortcut $DestinationPath to $SourceExe."
$WshShell = New-Object -comObject WScript.Shell
$WshShell = New-Object -ComObject ("WScript.Shell")
$Shortcut = $WshShell.CreateShortcut($DestinationPath)
$Shortcut.TargetPath = $SourceExe
$Shortcut.Arguments = $Arguments
$Shortcut.Save()
}

Expand All @@ -42,15 +45,17 @@ Push-Location $dir
}

# compile for release
cargo build --release
cargo rustc --release -- -Clink-args="-Wl,--subsystem,windows"

if (!(Test-Path $target)) {
Write-Error "Error: $target not found."
Pop-Location
exit 1
}

if (!(Test-Path $dist_dir)) {
Write-Error "Error: $dist_dir not found."
Pop-Location
exit 1
}

Expand All @@ -67,14 +72,18 @@ Push-Location $dir
Pop-Location # bin directory

# create shortcut to top level
Create-Shortcut ".\bin\$executable" ".\$shortcut"
Create-Shortcut `
"%windir%\explorer.exe" `
".\bin\$executable" `
"$(Resolve-Path -Path ".")\logicrs.lnk"
Pop-Location # dist directory

# create the distributable zip archive
Compress-Archive -Path $dist_dir -Update -DestinationPath $zip_name

if (!(Test-Path $zip_name)) {
Write-Error "Error: $zip_name not created."
Pop-Location
exit 1
}
else {
Expand Down
2 changes: 2 additions & 0 deletions windows-dist/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
!*
bin/logicrs.exe
logicrs.lnk
LICENSE
README.md
21 changes: 0 additions & 21 deletions windows-dist/LICENSE

This file was deleted.

49 changes: 0 additions & 49 deletions windows-dist/README.md

This file was deleted.

0 comments on commit 99f46c8

Please sign in to comment.