Skip to content

Commit

Permalink
feat: evaluate symbolic link real path (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmedeski authored Jan 23, 2024
1 parent c1e985f commit a3bb558
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion session/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path"
"path/filepath"

"github.com/joshmedeski/sesh/dir"
"github.com/joshmedeski/sesh/tmux"
Expand All @@ -19,7 +20,18 @@ func DeterminePath(choice string) (string, error) {
return cwd, nil
}
fullPath := dir.FullPath(choice)
if path.IsAbs(fullPath) {

realPath, err := filepath.EvalSymlinks(choice)
if err != nil {
fmt.Println("Couldn't evaluate symbolic link", err)
os.Exit(1)
}

if path.IsAbs(realPath) {
return realPath, nil
}

if path.IsAbs(realPath) {
return fullPath, nil
}

Expand Down

0 comments on commit a3bb558

Please sign in to comment.