         else
           type = "string" # Contents type defaults to string.
         @store.add {
-          loc: dir + "/" + name
+          loc: dir + "/" + name # Absolute path as universal ID.
           dir: dir
           name: name
           contents: contents or "" # Contents default to "".

    createDir: (dir, name) ->
      path = dir + "/" + name
      @store.add {
        loc: path + "/.dirExists"
        dir: path
        name: ".dirExists"
      }
      @store.add {
        loc: path + ".dir"
        dir: dir
        name: name + ".dir"

        dir: dir
      }
      contents = []
      contents.push {name: file.name, meta: file.meta} for file in files when not file.loc.match(@dirExp)?
      contents.push {name: dir.name, meta: {type: "dir"}} for dir in files when dir.loc.match(@dirExp)?
      return contents

    open: (path) ->
      handle = makeUuid @node
      file = @store.query {
        loc: path
      }
      if file?
        @handles[handle] = file
        return handle
      else
        return null

    flush: (handle) ->
      @store.put @handles[handle]

    close: (handle) ->
      flush handle
      delete @handles[handle]

    read: (handle) ->
      return @handles[handle]

    write: (handle, data) ->
      @handles[handle] = data
      return null

  return FileSystem
