Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Commit

Permalink
unbreak tests that broke after recent file-separator re-pattern changes
Browse files Browse the repository at this point in the history
  • Loading branch information
martinklepsch committed Jul 4, 2017
1 parent dc9e3ea commit 95a93d1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/io/perun/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@
[url]
(apply create-filepath (string/split url #"/")))

(def file-separator-re (re-pattern (java.util.regex.Pattern/quote java.io.File/separator)))
(def file-separator (re-pattern (java.util.regex.Pattern/quote java.io.File/separator)))

(defn path-to-url
"Converts a path to url"
[path]
(->> file-separator-re
(->> file-separator
re-pattern
(string/split path)
(string/join "/")))

Expand All @@ -72,7 +73,7 @@
filepath))

(defn filename [name]
(second (re-find #"(.+?)(\.[^.]*$|$)" (last (string/split name file-separator-re)))))
(second (re-find #"(.+?)(\.[^.]*$|$)" (last (string/split name (re-pattern file-separator))))))

(defn ^String extension [name]
(last (seq (string/split name #"\."))))
Expand Down

0 comments on commit 95a93d1

Please sign in to comment.