Skip to content

Commit

Permalink
Small fixes for windows
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tryy3 authored Dec 19, 2017
1 parent 1bc32bd commit 01cd062
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/mains/mains.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 01cd062

Please sign in to comment.