1 implementation module index
7 import System.Directory
13 derive JSONEncode RTree, FileInfo, Tm, MaybeError
14 derive JSONDecode RTree, FileInfo, Tm, MaybeError
17 { mdb_format :: [Format]
22 // { tag_key :: !String
23 // , tag_value :: !String
27 root = "/mnt/data/music"
29 writeJSON :: a String *World -> (MaybeErrorString (), *World) | JSONEncode{|*|} a
31 # (ok, f, w) = fopen fp FWriteData w
32 | not ok = (Error ("Cannot open " +++ fp +++ " as file"), w)
33 # (ok, w) = fclose (f <<< toJSON obj) w
34 | not ok = (Error ("Cannot close " +++ fp), w)
38 # (mfi, w) = getFileInfo root w
39 | isError mfi = abort "Cannot open root\n"
41 | not fi.directory = abort "Root is not a directory\n"
42 # (tree, w) = readDirectoryTree root Nothing w
43 = writeJSON tree dbfile w