Skip to content

Commit

Permalink
Add a utility function to find the relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
pbiggar committed Apr 16, 2012
1 parent 4596f0f commit ae4b994
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/dieter/path.clj
Expand Up @@ -84,3 +84,9 @@ static file middleware can be rooted at cache-root"
(defmethod cache-busting-path :production [settings path]
(or (get @cached-paths path)
(add-md5 path (str (java.util.Date.)))))

(defn relative-path [root file]
(let [absroot (fs/abspath root)
absfile (fs/abspath file)
root-length (count absroot)]
(.substring absfile (inc root-length))))

0 comments on commit ae4b994

Please sign in to comment.