scripts: edit: Fix relative file-name with 'load-path' option.

* guix/scripts/edit.scm (search-path*): Return 'file' if exists when
'search-path' fails.

Change-Id: I891d63d0d28577a7d1732fc59435828ecc0a5c5a
This commit is contained in:
Simon Tournier 2023-11-02 21:25:43 +01:00
parent ab94e80601
commit 1eb3133355
No known key found for this signature in database
GPG Key ID: 92F1D22C608EE7E5
1 changed files with 5 additions and 1 deletions

View File

@ -64,7 +64,11 @@ Start $VISUAL or $EDITOR to edit the definitions of PACKAGE...\n"))
(define (search-path* path file)
"Like 'search-path' but exit if FILE is not found."
(let ((absolute-file-name (search-path path file)))
(let ((absolute-file-name (or (search-path path file)
;; It could be that FILE is a relative name
;; i.e., not relative to an element of PATH.
(and (file-exists? file)
file))))
(unless absolute-file-name
;; Shouldn't happen unless somebody fiddled with the 'location' field.
(leave (G_ "file '~a' not found in search path ~s~%")