os.scm 899 B

123456789101112131415161718192021
  1. (define-module (utils os))
  2. (define-public path-join
  3. (lambda (. parts)
  4. (let ([parts-no-trailing-slashes
  5. (map (lambda (part)
  6. (string-trim-right part
  7. (lambda (char)
  8. #;(display
  9. (simple-format
  10. #f "checking char: ~a ... will remain? ~a\n"
  11. char
  12. (if (char=? char #\/) "no" "yes")))
  13. (char=? char
  14. (car
  15. (string->list
  16. file-name-separator-string))))))
  17. parts)])
  18. (string-join parts-no-trailing-slashes file-name-separator-string))))