From 01cd0625ab0d99715f37f0174e0c6583b51281dc Mon Sep 17 00:00:00 2001 From: Tryy3 Date: Tue, 19 Dec 2017 16:11:02 +0100 Subject: [PATCH] Small fixes for windows Because windows uses a different filesystem, it's better to use the filepath package, I am sure there is more problems, but this fix will at least make joy work. --- internal/mains/mains.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/mains/mains.go b/internal/mains/mains.go index 10407b31..f4396983 100644 --- a/internal/mains/mains.go +++ b/internal/mains/mains.go @@ -33,13 +33,13 @@ func Find(packages ...string) (mains []string, err error) { for i, pkg := range packages { // no prefix - if pkg[0] != '.' && pkg[0] != filepath.Separator { + if pkg[0] != '.' && !filepath.IsAbs(pkg) { packages[i] = "." + string(filepath.Separator) + pkg continue } // absolute - if pkg[0] == filepath.Separator { + if filepath.IsAbs(pkg) { rel, err := filepath.Rel(cwd, pkg) if err != nil { return mains, errors.Wrapf(err, "unable to get relative path") @@ -84,7 +84,7 @@ func Find(packages ...string) (mains []string, err error) { if parts[1] == "command-line-arguments" { // TODO: i don't think this will work for multiple files for _, pkg := range packages { - results = append(results, path.Join(cwd, path.Dir(pkg))) + results = append(results, path.Join(cwd, filepath.Dir(pkg))) } continue }