     if event == 'deleted'
         if filecache.get(filepath)?
             console.log("nuking", filepath, "from dropbox")
-            db.delete filename, (error) ->
+            db.delete localToDropboxPath(filename), (error) ->
                 throw(error) if error?
                 filecache.rm(filepath)
         else

# pass in environment variables DROPBOX_API_KEY, DROPBOX_API_SECRET, DROPBOX_USER_TOKEN,
# DROPBOX_LOCAL_DIR, DROPBOX_PATH_PREFIX

# TODO: fix path prefix to be removed and added correctly from Dropbox API calls and results.

cluster = require('cluster')


userToken = process.env.DROPBOX_USER_TOKEN
base = process.env.DROPBOX_LOCAL_DIR
pathPrefix = process.env.DROPBOX_PATH_PREFIX

if base
    if base[0] == '/'
        base = base.substring(1)
if pathPrefix
    if pathPrefix[0] == '/'
        pathPrefix = pathPrefix.substring(1)

hash = (data) ->
    shasum = crypto.createHash('sha1')
