From a335f4599b70a06a804dbc500c627311bcce471d Mon Sep 17 00:00:00 2001 From: Masahiro331 Date: Thu, 8 Jun 2023 13:33:11 +0900 Subject: [PATCH] Revert "replaced filepath.Separator with "/" (#2)" (#5) This reverts commit 7a08aef44f20a69e790bc2f942cfef71d633ae8f. --- xfs/xfs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xfs/xfs.go b/xfs/xfs.go index f2ecde0..b64e199 100644 --- a/xfs/xfs.go +++ b/xfs/xfs.go @@ -151,7 +151,7 @@ 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) @@ -159,7 +159,7 @@ func (xfs *FileSystem) ReadDirInfo(name string) (fs.FileInfo, error) { 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() } } @@ -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 {