diff --git a/e_cmd.go b/e_cmd.go index 0b75d3d..9979bd2 100644 --- a/e_cmd.go +++ b/e_cmd.go @@ -6,7 +6,6 @@ import ( "fmt" "os" "path" - "strings" ) const ( @@ -52,13 +51,13 @@ func (c *ECmd) InitWithFlag() error { if err != nil { return err } - if !strings.HasPrefix(c.BundlePath, "/") { + if !path.IsAbs(c.BundlePath) { c.BundlePath = path.Join(pwd, c.BundlePath) } - if !strings.HasPrefix(c.DistPath, "/") { + if !path.IsAbs(c.DistPath) { c.DistPath = path.Join(pwd, c.DistPath) } - if !strings.HasPrefix(c.OutputPath, "/") { + if !path.IsAbs(c.OutputPath) { c.OutputPath = path.Join(pwd, c.OutputPath) } diff --git a/main.go b/main.go index 6ac4450..a9ec407 100644 --- a/main.go +++ b/main.go @@ -54,6 +54,13 @@ func main() { log.Fatal(err) } + // mkdir + if _, err = os.Stat(eCmd.OutputPath); os.IsNotExist(err) { + err := os.MkdirAll(eCmd.OutputPath, 0731) + if err != nil { + log.Fatal(err) + } + } // build zip file zFile, err := os.Create(path.Join(eCmd.OutputPath, app.OutputZipFileName())) if err != nil {