revel/revel#389 run cmd become more robust

This commit is contained in:
Jeevanandam M
2016-06-17 18:48:14 -07:00
parent c18d43d25e
commit 4b46dbb1a7
2 changed files with 79 additions and 22 deletions

View File

@@ -8,6 +8,7 @@ import (
"archive/tar"
"compress/gzip"
"fmt"
"go/build"
"io"
"os"
"path/filepath"
@@ -167,3 +168,9 @@ func empty(dirname string) bool {
results, _ := dir.Readdir(1)
return len(results) == 0
}
func importPathFromCurrentDir() string {
pwd, _ := os.Getwd()
importPath, _ := filepath.Rel(filepath.Join(build.Default.GOPATH, "src"), pwd)
return filepath.ToSlash(importPath)
}