diff --git a/backend-golang/file.go b/backend-golang/file.go index 104f830..e34b71f 100644 --- a/backend-golang/file.go +++ b/backend-golang/file.go @@ -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 diff --git a/backend-golang/utils.go b/backend-golang/utils.go index 7adedff..b9e5af0 100644 --- a/backend-golang/utils.go +++ b/backend-golang/utils.go @@ -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 {