cmd/t5de-setup is the installer users will run: a Wails window with a plain HTML/CSS/JS page that walks through finding and checking IMVU Classic, choosing patches (required ones locked; turning a patch on turns on what it needs), options and installing, with progress. When T5DE is already installed, or when run from the copy kept in the install, it offers changing patches, repair or update, and uninstall; "Apps & features" opens its uninstall page. It runs from a temporary copy when it would otherwise change its own folder. For it, apply and install report progress, the bundle can be loaded from bytes (setup carries it built in), the System reports the registered install, and the relaunch logic moved from the command-line patcher into install. The T5DE logo and icon are in patcher/assets. CI vets the wizard and cross-compiles it for Windows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
32 lines
1003 B
Go
32 lines
1003 B
Go
package install
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
// relaunchPrefix names the temporary copies Relaunch makes.
|
|
const relaunchPrefix = "t5de-setup-tmp-"
|
|
|
|
// Relaunch starts a copy of exe in the temporary folder with args, for changing or removing the install exe runs
|
|
// from: Windows can't delete or replace a running program. The copy deletes itself when done (see Cleanup).
|
|
func Relaunch(exe string, args []string) error {
|
|
copyPath := filepath.Join(os.TempDir(), fmt.Sprintf("%s%d.exe", relaunchPrefix, os.Getpid()))
|
|
if err := copyFile(exe, copyPath); err != nil {
|
|
return err
|
|
}
|
|
cmd := exec.Command(copyPath, args...)
|
|
cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
|
return cmd.Start()
|
|
}
|
|
|
|
// Cleanup deletes the running program after it exits if it's a copy Relaunch made. Call it before exiting.
|
|
func Cleanup() {
|
|
if exe, err := os.Executable(); err == nil && strings.HasPrefix(filepath.Base(exe), relaunchPrefix) {
|
|
deleteAfterExit(exe)
|
|
}
|
|
}
|