feature/go-rewrite : base Go avec walk GUI
- Rewrite complet en Go : exe unique sans _internal/, sans extraction temp - GUI Windows-native via github.com/lxn/walk (TableView, TextEdit, PushButton) - Meme fonctionnalites : check repos, pull, checkout, auto-update, logs - build.bat : go build -ldflags "-H windowsgui -s -w" -> 9.6 Mo, zero dependance Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
40
platform_windows.go
Normal file
40
platform_windows.go
Normal file
@@ -0,0 +1,40 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
const createNoWindow = 0x08000000
|
||||
|
||||
// newGitCmd crée une commande git sans fenêtre console.
|
||||
func newGitCmd(ctx context.Context, args []string, cwd string) *exec.Cmd {
|
||||
cmd := exec.CommandContext(ctx, "git", args...)
|
||||
if cwd != "" {
|
||||
cmd.Dir = cwd
|
||||
}
|
||||
cmd.SysProcAttr = &windows.SysProcAttr{
|
||||
CreationFlags: createNoWindow,
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
||||
// relaunchAfterUpdate crée un batch qui attend 1s, relance l'exe et nettoie le .old.
|
||||
func relaunchAfterUpdate(exePath string) {
|
||||
oldPath := exePath + ".old"
|
||||
batPath := exePath + "_update.bat"
|
||||
content := fmt.Sprintf(
|
||||
"@echo off\r\ntimeout /t 1 /nobreak >nul\r\nstart \"\" \"%s\"\r\ndel \"%s\" 2>nul\r\ndel \"%%~f0\"\r\n",
|
||||
exePath, oldPath,
|
||||
)
|
||||
os.WriteFile(batPath, []byte(content), 0644)
|
||||
cmd := exec.Command("cmd", "/c", batPath)
|
||||
cmd.SysProcAttr = &windows.SysProcAttr{CreationFlags: createNoWindow}
|
||||
cmd.Start()
|
||||
}
|
||||
Reference in New Issue
Block a user