9 // fixPathForm changes a file name to a relative name
10 func fixPathForm(last string, file string) string {
11 // get wording directory for relative name
12 workDir, err := os.Getwd()
17 abs, err := filepath.Abs(file)
22 // if last is absolute, return path as absolute
23 if filepath.IsAbs(last) {
24 return fixDirPath(abs)
27 rel, err := filepath.Rel(workDir, abs)
32 // fix ./ prefix of path
33 if rel != "." && strings.HasPrefix(last, ".") {
37 return fixDirPath(rel)
40 func fixDirPath(path string) string {
41 info, err := os.Stat(path)
42 if err == nil && info.IsDir() && !strings.HasSuffix(path, "/") {