Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fileglob.Glob doesn't work with an absolute path on Windows #54

Open
rhysd opened this issue Jul 24, 2024 · 0 comments
Open

fileglob.Glob doesn't work with an absolute path on Windows #54

rhysd opened this issue Jul 24, 2024 · 0 comments

Comments

@rhysd
Copy link

rhysd commented Jul 24, 2024

Related to #19. I saw this comment. So I used filepath.ToSlash but it still doesn't work in this case.

Repro

Run the following code on Windows:

import (
  "fmt"
  "path/filepath"
  "github.com/goreleaser/fileglob"
)

func main() {
  x, err := fileglob.Glob(filepath.ToSlash(`C:\Windows`))
  if err != nil {
    panic(err)
  }
  fmt.Println(x)
}

Expected behavior

Since C:\Windows exists, it should print a slice with one element.

Actual behavior

It panicked with the following error:

stat static prefix ./C:/Windows: stat C:/Windows: invalid argument

filepath.ToSlash(`C:\Windows`) returns "C:/Windows". The function didn't seem to consider the C: drive letter and misunderstood that the path was relative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant