diff --git a/src/mw_ui/layout.clj b/src/mw_ui/layout.clj index da3175b..32568a8 100644 --- a/src/mw_ui/layout.clj +++ b/src/mw_ui/layout.clj @@ -32,7 +32,6 @@ (def template-path "templates/") - (deftype RenderableTemplate [template params] Renderable (render [_ request] diff --git a/src/mw_ui/render_world.clj b/src/mw_ui/render_world.clj index 6499339..0a1f2f7 100644 --- a/src/mw_ui/render_world.clj +++ b/src/mw_ui/render_world.clj @@ -1,12 +1,9 @@ (ns ^{:doc "Render the state of the world as an HTML table." :author "Simon Brooke"} mw-ui.render-world - (:require [clojure.java.io :as jio] - [mw-engine.core :as engine] - [mw-engine.world :as world] + (:require [mw-engine.core :as engine] [mw-engine.heightmap :as heightmap] [mw-parser.bulk :as compiler] - [hiccup.core :refer [html]] [noir.io :as io] [noir.session :as session])) diff --git a/src/mw_ui/util.clj b/src/mw_ui/util.clj index 5f975b6..19f9b61 100644 --- a/src/mw_ui/util.clj +++ b/src/mw_ui/util.clj @@ -31,18 +31,22 @@ ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(def running-from-filesystem (atom true)) +(def running-from-filesystem + "We assume we're running from the filesystem unless we find we're not." + (atom true)) + (def compile-time-resources "The resources which were visible at compile time. If we are running from a JAR file, it is highly likely that these are all the resources available at run time." - (let [n (count (io/resource-path))] + (let [f (file "resources/public") + n (count (.getCanonicalPath f))] (remove nil? - (map #(let [s (str %)] + (map #(let [s (.getCanonicalPath %)] (when (> (count s) n) - (subs s 56))) - (file-seq (file (io/resource-path))))))) + (subs s n))) + (file-seq f))))) (defn md->html @@ -57,12 +61,13 @@ "Do the same processing that list-resources does on names fetched from the file system, except on the resource list cached at compile time." [path pattern] + (timbre/info compile-time-resources) (let [n (count path)] (remove nil? (map #(when (> (count %) n) (let [name (subs % n)] - (first (rest (re-matches pattern name))))) - (filter #(starts-with? % path) + (last (re-matches pattern name)))) + (filter #(starts-with? % path) compile-time-resources)))))