milkey-mouse / edit

Cross-platform Rust library for invoking & waiting for the system text editor
Creative Commons Zero v1.0 Universal
43 stars 8 forks source link

allow absolute paths if they exist. #8

Closed ammkrn closed 3 years ago

ammkrn commented 3 years ago

If a user's EDITOR is an absolute path to something that isn't actually in their PATH, the which function doesn't seem to pick it up; it gets ignored which in turn causes get_full_editor_path to fail. This change just makes it so that if which fails, but the path specified by the user points to an existing entity, the existing entity gets used instead of the fallback.

My EDITOR variable is an absolute path to my nvim binary, but a program I'm using that depends on this crate keeps showing me nano as a fallback.

ammkrn commented 3 years ago

The force push was to bump the semver patch number.

milkey-mouse commented 3 years ago

Merged in 263fed0, thanks! Honestly it's weird I didn't notice this earlier as several of my computers run Guix, which refers to binaries outside PATH all the time.

The patch number doesn't necessarily need to be incremented in each change's commit; I typically push a separate commit just to increment the version which is also the one I tag for the release.