xwmx / nb

CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
https://xwmx.github.io/nb
GNU Affero General Public License v3.0
6.58k stars 187 forks source link

Symlinked .nbrc doesn't work with relative links #87

Open manimax3 opened 3 years ago

manimax3 commented 3 years ago

In my setup I had .nbrc symlinked to dotfiles/nbrc and not to an absolute path like ~/dotfiles/nbrc. But nb seems to read the symlink path with readlink and this returns an invalid path if the current working dir is not ~.

Is there any reason why a symbolic link needs to be resolved like that? The fix on the user side is obviously easy (just change to an absolute path) but the issue was weird to debug since nb just used the default config and worked fine in the home dir.

xwmx commented 3 years ago

@manimax3 Thanks! I updated it to use realpath whenever that's available, falling back to readlink otherwise. This is available in the latest versions of the git repository. Let me know if you know of a better approach (readlink -f doesn't work on macOS).