fix Cmd and CopyFile

This commit is contained in:
josc146 2023-05-31 16:27:43 +08:00
parent 2f5a7d2d51
commit b03b00419b
2 changed files with 11 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"
)
@ -100,6 +101,11 @@ func (a *App) CopyFile(src string, dst string) error {
}
defer sourceFile.Close()
err = os.MkdirAll(dst[:strings.LastIndex(dst, "/")], 0755)
if err != nil {
return err
}
destFile, err := os.Create(dst)
if err != nil {
return err

View File

@ -15,6 +15,11 @@ import (
)
func Cmd(args ...string) (string, error) {
path, err := filepath.Abs(args[0])
if err != nil {
return "", err
}
args[0] = path
if runtime.GOOS == "windows" {
_, err := os.Stat("cmd-helper.bat")
if err != nil {