633
634
635
636
637
638
639
640
641
642
643
644
645
646
|
(define (common:nice-path dir)
(let ((match (string-match "^(~[^\\/]*)(\\/.*|)$" dir)))
(if match ;; using ~ for home?
(common:nice-path (conc (common:read-link-f (cadr match)) "/" (caddr match)))
(normalize-pathname (if (absolute-pathname? dir)
dir
(conc (current-directory) "/" dir))))))
(define (common:read-link-f path)
(handle-exceptions
exn
(begin
(debug:print 0 "ERROR: command \"/bin/readlink -f " path "\" failed.")
path) ;; just give up
|
>
>
>
|
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
|
(define (common:nice-path dir)
(let ((match (string-match "^(~[^\\/]*)(\\/.*|)$" dir)))
(if match ;; using ~ for home?
(common:nice-path (conc (common:read-link-f (cadr match)) "/" (caddr match)))
(normalize-pathname (if (absolute-pathname? dir)
dir
(conc (current-directory) "/" dir))))))
;; make "nice-path" available in config files and the repl
(define nice-path common:nice-path)
(define (common:read-link-f path)
(handle-exceptions
exn
(begin
(debug:print 0 "ERROR: command \"/bin/readlink -f " path "\" failed.")
path) ;; just give up
|