Plugin files

CmdrDats edited this page Jan 3, 2013 · 1 revision

Plugin files

(:require [cljminecraft.files :as f])

Source: files.clj


Convenience functions for reading/writing files against a plugin. This uses, by default, the json format for reading/writing files because it translates very nicely into clojure maps.


You can get the current data folder for a plugin with data-folder

cljminecraft.core> (f/data-folder plugin)
#<File plugins/cljminecraft>

Write a hashmap to a file with write-json-file

cljminecraft.core> (f/write-json-file plugin "mymap.json" {:name "goodmorning"})

And read it back in with read-json-file:

cljminecraft.core> (cljminecraft.files/read-json-file @clj-plugin "mymap.json")
{:name "good morning"}