-
Notifications
You must be signed in to change notification settings - Fork 34
Plugin files
CmdrDats edited this page Jan 4, 2013
·
1 revision
(: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"})
nilAnd read it back in with read-json-file:
cljminecraft.core> (cljminecraft.files/read-json-file @clj-plugin "mymap.json")
{:name "good morning"}