diff --git a/src/environment/shell.go b/src/environment/shell.go index 13a205c8..8e1726ba 100644 --- a/src/environment/shell.go +++ b/src/environment/shell.go @@ -654,12 +654,12 @@ func (env *ShellEnvironment) HasParentFilePath(path string) (*FileInfo, error) { defer env.Trace(time.Now(), "HasParentFilePath", path) currentFolder := env.Pwd() for { - searchPath := filepath.Join(currentFolder, path) - info, err := os.Stat(searchPath) + fileSystem := os.DirFS(currentFolder) + info, err := fs.Stat(fileSystem, path) if err == nil { return &FileInfo{ ParentFolder: currentFolder, - Path: searchPath, + Path: filepath.Join(currentFolder, path), IsDir: info.IsDir(), }, nil } diff --git a/src/main_test.go b/src/main_test.go index d00ec3e6..45651608 100644 --- a/src/main_test.go +++ b/src/main_test.go @@ -21,7 +21,7 @@ func BenchmarkInit(b *testing.B) { func BenchmarkPrimary(b *testing.B) { cmd := cli.RootCmd // needs to be a non-existing file as we panic otherwise - cmd.SetArgs([]string{"print", "primary", "--config", "err.omp.json", "--pwd", "/Users/jan/Code/oh-my-posh/src"}) + cmd.SetArgs([]string{"print", "primary", "--config", "err.omp.json", "--pwd", "/Users/jan/Code/oh-my-posh/src", "--shell", "fish"}) out := bytes.NewBufferString("") cmd.SetOut(out)