On Wed, Nov 23, 2011 at 10:03 PM,
<address@hidden> wrote:
-[ Wed, Nov 23, 2011 at 08:28:56PM +0800, Nala Ginrut ]----
> I think there's no such a given function in Guile to do this.
> But you can make it in a easy way in Guile:
> (catch 'system-error
> (lambda () (execlp "asdfasdf"))
> (lambda (k . e)
> (format #t "oh no~%~")))
>
> PS: Maybe you need #f instead of "format" according to your letter. ;-)
It's my understanding that the OP does not want to actually run the
program but merely knows either the file is in the PATH or not.
I guess some-function would be something like :
(use-modules (srfi srfi-1)) ; for any
(define (in-path? f)
(let ((path (string-split (getenv "PATH") #\:))
(make-absolute (lambda (path) (string-append path "/" f))))
(any file-exists? (map make-absolute path))))
Well, I realized that Paul want this some-function to detect whether file can be executed.
[quote]