~ruther/guix-exprs

ref: 7db83c5ef902537051a2836fe6754a689ad26bc0 guix-exprs/modules/ruther/build/utils.scm -rw-r--r-- 391 bytes
7db83c5e — Rutherther feat: Replace original paths in extra files with the ones in environment 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
(define-module (ruther build utils)
  #:use-module (ice-9 popen)
  #:use-module (ice-9 textual-ports)
  #:export (file-is-text-file?))

(define (file-is-text-file? file)
  (let* ((port
         (open-input-pipe (string-append "file -b0 --mime-encoding " (canonicalize-path file))))
         (output (get-string-all port)))
    (close-pipe port)
    (not (string-contains output "binary"))))