Skip to content

Commit

Permalink
fix symlinks on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lkingland committed Jun 26, 2023
1 parent f939f22 commit 12e1b6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion generate/templates/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func main() {
if err != nil {
return err
}
_, err = w.Write([]byte(symlinkTarget))
_, err = w.Write([]byte(filepath.ToSlash(symlinkTarget)))
return err
case info.Mode()&fs.ModeType == 0: // regular file
f, err := os.Open(path)
Expand Down
6 changes: 5 additions & 1 deletion pkg/filesystem/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ func (o osFilesystem) Stat(name string) (fs.FileInfo, error) {

func (o osFilesystem) Readlink(link string) (string, error) {
link = filepath.FromSlash(link)
return os.Readlink(filepath.Join(o.root, link))
t, err := os.Readlink(filepath.Join(o.root, link))
if err != nil {
return "", err
}
return filepath.ToSlash(t), nil
}

// subFS exposes subdirectory of underlying FS, this is similar to `chroot`.
Expand Down

0 comments on commit 12e1b6f

Please sign in to comment.