(defn ^String path [x]
(cond
(file? x) (.getAbsolutePath ^File x)
(url? x) (if windows?
(let [f (URLDecoder/decode (.getFile x))]
(normalize-path f))
(.getPath ^URL x))
(string? x) x
:else (throw (Exception. (str "Expected file, url, or string. Got " (pr-str x))))))