         dir: dir
       }
       contents = []
-      contents.push {name: file.name, meta: file.meta} for file in files when file.name isnt ".dirExists" and not file.name.matches(@dirExp)?
-      contents.push {name: dir.name, meta: {type: "dir"}} for dir in files when dir.name.matches(@dirExp)?
+      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: (dir, name) ->
+    open: (path) ->
       handle = makeUuid @node
       file = @store.query {
-        path: dir + "/" + name
-        dir: dir
-        name: name
+        loc: path
       }
       if file?
-        handles[handle] = file
+        @handles[handle] = file
         return handle
       else
         return null
 
     flush: (handle) ->
-      @store.put handles[handle]
+      @store.put @handles[handle]
 
     close: (handle) ->
       flush handle
-      delete handles[handle]
+      delete @handles[handle]
+
+    read: (handle) ->
+      return @handles[handle]
+
+    write: (handle, data) ->
+      @handles[handle] = data
+      return null
 
   return FileSystem

  "../lib/local-storage/LocalStorage",
  "../lib/dojox/uuid/generateTimeBasedUuid"
], (LocalStorage, makeUuid) ->
  class FileSystem
    constructor: ->
      if not localStorage?
        errMsg = "CoffeeScript OS requires Web Storage. Please try again using Chrome > 4.0, Safari > 4.0, IE > 8.0, Firefox > 3.5, or Opera > 11.5"
        alert errMsg
        throw new Error errMsg + "."
      @store = new LocalStorage {
        idProperty: "loc"
      }
      @handles = []
      @dirExp = new RegExp "\.dir$"

    getNextId = ->
      id = @store.get(0).contents
      id = 1 if not id?
      @store.put {contents: id, loc: "/.nextInode"}
      return id

    createFile: (dir, name, contents, acl) ->
      inDir = @store.query {
        dir: dir
      }
      if inDir[0]?
        if contents?

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