add file header validation

This commit is contained in:
Gered 2014-03-29 13:44:24 -04:00
parent 4455bb6d65
commit 197b5d20ee

View file

@ -9,8 +9,10 @@
:num-comments (Integer/parseInt (nth parts 5))}))
(defn load-flf [file]
(let [lines (str/split (slurp file) #"\n")
header (parse-flf-header (first lines))
char-lines (drop (inc (:num-comments header)) lines)]
))
(let [flf-file (slurp file)]
(if-not (= "flf2a" (subs flf-file 0 5))
(throw (new Exception (str "Not a valid flf font file: " file))))
(let [lines (str/split (slurp file) #"\n")
header (parse-flf-header (first lines))
char-lines (drop (inc (:num-comments header)) lines)]
)))