mirror of
https://github.com/Cheviiot/Vintner.git
synced 2026-08-03 15:57:24 +00:00
--dest (download) and the positional dir (install) were previously required, forcing every user to pick and remember a location. Both now default to a single hidden ~/.msvc-go-wine, matching the convention most CLI tools use for their own data dir - still overridable for anyone who wants a different location.
42 lines
921 B
Go
42 lines
921 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/Cheviiot/msvc-go-wine/internal/install"
|
|
)
|
|
|
|
func runInstall(args []string) int {
|
|
if len(args) > 1 || (len(args) == 1 && (args[0] == "-h" || args[0] == "--help")) {
|
|
fmt.Fprintln(os.Stderr, "usage: msvc-go-wine install [dest] (default: ~/.msvc-go-wine)")
|
|
return 1
|
|
}
|
|
|
|
var dest string
|
|
if len(args) == 1 {
|
|
dest = args[0]
|
|
} else {
|
|
def, err := defaultToolchainDir()
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "msvc-go-wine install:", err)
|
|
return 1
|
|
}
|
|
dest = def
|
|
fmt.Println("No directory given, using default:", dest)
|
|
}
|
|
|
|
self, err := os.Executable()
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "msvc-go-wine install:", err)
|
|
return 1
|
|
}
|
|
|
|
if err := install.Install(dest, self); err != nil {
|
|
fmt.Fprintln(os.Stderr, "msvc-go-wine install:", err)
|
|
return 1
|
|
}
|
|
fmt.Println("Done. Add", dest+"/bin/<arch> to PATH to use cl, link, lib, ...")
|
|
return 0
|
|
}
|