Skip to content

Commit

Permalink
fix: dont throw error when symlink is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mistakenelf committed Aug 8, 2022
1 parent 8d1926f commit ca3f779
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions filetree/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ type copyToClipboardMsg string
type editorFinishedMsg struct{ err error }

// getDirectoryListingCmd updates the directory listing based on the name of the directory provided.
func getDirectoryListingCmd(name string, showHidden, showIcons bool) tea.Cmd {
func getDirectoryListingCmd(directoryName string, showHidden, showIcons bool) tea.Cmd {
return func() tea.Msg {
var err error
var items []list.Item

directoryName := name
if name == dirfs.HomeDirectory {
if directoryName == dirfs.HomeDirectory {
directoryName, err = dirfs.GetHomeDirectory()
if err != nil {
return errorMsg(err)
Expand Down Expand Up @@ -76,12 +75,12 @@ func getDirectoryListingCmd(name string, showHidden, showIcons bool) tea.Cmd {
if fileInfo.Mode()&os.ModeSymlink == os.ModeSymlink {
symlinkFile, err := os.Readlink(fileInfo.Name())
if err != nil {
return errorMsg(err)
continue
}

symlinkFileInfo, err := os.Stat(symlinkFile)
if err != nil {
return errorMsg(err)
continue
}

status := fmt.Sprintf("%s %s %s",
Expand Down

0 comments on commit ca3f779

Please sign in to comment.