Skip to content

Commit

Permalink
Revert "replaced filepath.Separator with "/" (#2)" (#5)
Browse files Browse the repository at this point in the history
This reverts commit 7a08aef.
  • Loading branch information
masahiro331 committed Jun 8, 2023
1 parent db911cc commit a335f45
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xfs/xfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ func (xfs *FileSystem) ReadDirInfo(name string) (fs.FileInfo, error) {
mode: fs.FileMode(inode.inodeCore.Mode),
}, nil
}
name = strings.TrimRight(name, "/")
name = strings.TrimRight(name, string(filepath.Separator))

dirs, dir := path.Split(name)
dirEntries, err := xfs.readDirEntry(dirs)
if err != nil {
return nil, xerrors.Errorf("failed to read dir entry: %w", err)
}
for _, entry := range dirEntries {
if entry.Name() == strings.Trim(dir, "/") {
if entry.Name() == strings.Trim(dir, string(filepath.Separator)) {
return entry.Info()
}
}
Expand Down Expand Up @@ -275,7 +275,7 @@ func (xfs *FileSystem) readDirEntry(name string) ([]fs.DirEntry, error) {
}

currentInode := inode
dirs := strings.Split(strings.Trim(filepath.Clean(name), "/"), "/")
dirs := strings.Split(strings.Trim(filepath.Clean(name), string(filepath.Separator)), string(filepath.Separator))
for i, dir := range dirs {
found := false
for _, fileInfo := range fileInfos {
Expand Down

0 comments on commit a335f45

Please sign in to comment.