mirror of https://github.com/liamg/aminal.git
Fix Windows launcher
This commit is contained in:
parent
8b3634852d
commit
801b0a1fd6
3
Makefile
3
Makefile
|
@ -69,7 +69,8 @@ launcher-windows: build-windows
|
|||
if exist "bin\windows\Aminal" rmdir /S /Q "bin\windows\Aminal"
|
||||
mkdir "bin\windows\Aminal\Versions\${VERSION}"
|
||||
go build -o "bin\windows\Aminal\${BINARY}.exe" -ldflags "-H windowsgui" "${GEN_SRC_DIR}\launcher"
|
||||
copy ${BINARY}-windows-amd64.exe "bin\windows\Aminal\Versions\${VERSION}\${BINARY}.exe" /Y
|
||||
windres -o aminal.syso aminal.rc
|
||||
go build -o "bin\windows\Aminal\Versions\${VERSION}\${BINARY}.exe" -ldflags "-H windowsgui"
|
||||
IF "${WINDOWS_CODESIGNING_CERT_PW}"=="" ECHO Environment variable WINDOWS_CODESIGNING_CERT_PW is not defined. & exit 1
|
||||
signtool sign /f windows\codesigning_certificate.pfx /p "${WINDOWS_CODESIGNING_CERT_PW}" /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp bin\windows\Aminal\${BINARY}.exe
|
||||
signtool sign /f windows\codesigning_certificate.pfx /p "${WINDOWS_CODESIGNING_CERT_PW}" /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /as /fd sha256 /td sha256 bin\windows\Aminal\${BINARY}.exe
|
||||
|
|
|
@ -22,11 +22,13 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"github.com/liamg/aminal/windows/winutil"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
type Version struct {
|
||||
|
@ -42,8 +44,23 @@ func main() {
|
|||
versionsDir := filepath.Join(executableDir, "Versions")
|
||||
latestVersion, err := getLatestVersion(versionsDir)
|
||||
check(err)
|
||||
target := filepath.Join(versionsDir, latestVersion, executableName)
|
||||
cmd := exec.Command(target, os.Args[1:]...)
|
||||
usr, err := user.Current()
|
||||
check(err)
|
||||
cmd := exec.Command("C:\\Windows\\System32\\cmd.exe", "/C", "start", "Aminal", "/B", executableName)
|
||||
cmd.Dir = usr.HomeDir
|
||||
latestVersionDir := filepath.Join(versionsDir, latestVersion)
|
||||
path, pathSet := os.LookupEnv("PATH")
|
||||
if (pathSet) {
|
||||
path += ";" + latestVersionDir
|
||||
} else {
|
||||
path = latestVersionDir
|
||||
}
|
||||
cmd.Env = append(os.Environ(), "PATH=" + path)
|
||||
const CREATE_NO_WINDOW = 0x08000000
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||
HideWindow: true,
|
||||
CreationFlags: CREATE_NO_WINDOW,
|
||||
}
|
||||
check(cmd.Start())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue