diff options
Diffstat (limited to 'guix/build/utils.scm')
-rw-r--r-- | guix/build/utils.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 8f0eb66d39..99a43cfebd 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -26,6 +26,7 @@ #:use-module (rnrs bytevectors) #:use-module (rnrs io ports) #:export (directory-exists? + executable-file? with-directory-excursion mkdir-p copy-recursively @@ -56,6 +57,12 @@ (and s (eq? 'directory (stat:type s))))) +(define (executable-file? file) + "Return #t if FILE exists and is executable." + (let ((s (stat file #f))) + (and s + (not (zero? (logand (stat:mode s) #o100)))))) + (define-syntax-rule (with-directory-excursion dir body ...) "Run BODY with DIR as the process's current directory." (let ((init (getcwd))) |