improve error messages

This commit is contained in:
josc146
2023-06-15 21:57:54 +08:00
parent 21c3009945
commit d99488f22f
5 changed files with 24 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import (
"errors"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
@@ -51,6 +52,10 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
if python == "" {
python, err = GetPython()
if runtime.GOOS == "windows" {
python, err = filepath.Abs(python)
if err != nil {
return "", err
}
python = `"` + python + `"`
}
}

View File

@@ -115,19 +115,11 @@ func GetPython() (string, error) {
if err != nil {
return "", errors.New("failed to unzip python")
} else {
python, err := filepath.Abs("py310/python.exe")
if err != nil {
return "", err
}
return python, nil
return "py310/python.exe", nil
}
}
} else {
python, err := filepath.Abs("py310/python.exe")
if err != nil {
return "", err
}
return python, nil
return "py310/python.exe", nil
}
case "darwin":
return "python3", nil