Raynes / fs

File system utilities for Clojure.
453 stars 119 forks source link

Utility to join components (OS-aware) #119

Closed mizlan closed 3 years ago

mizlan commented 3 years ago

Is there a way to join components of a path, for example something like this?

(fs/join "/Users" "michael" "code")
;; => "/Users/michael/code"

It would be similar to Python's os.path.join for reference.

Since most of the functions in this library return Files, i'm not sure how this should work for a non-existent filepath.

SalvatoreTosti commented 3 years ago

@mizlan I think you can achieve this using the Java File.separator via interop. :) (clojure.string/join (. java.io.File separator) ["Users" "michael" "code"])

mizlan commented 3 years ago

This works great, thank you so much!