+
+# Config
+config    = require './config'
+
+# Logger
+log4js    = require 'log4js'
+log       = log4js.getLogger("[#{config.name}]")
 
 # Custom Libraries for this Util
 fs        = require 'fs'

    @message = message or "You are not authorized to do this."
    @name = 'AuthorizationError'

normalizeUserPath = (username, path)-> path?.replace(/\~/g, '/Users/#{username}')
safeForUser       = (username, path)-> path?.indexOf("/Users/#{username}/") is 0
escapePath        = (path)-> if path then nodePath.normalize path.replace(/[^a-zA-Z0-9\/\-. ]/g, '')
                                                                 .replace(/\s/g, '\\ ')

    # Needs to FIX
    chownr {path, username}, callback

createAppsDir = (username, cb)->
  path = escapePath "/Users/#{username}/Applications"
  if not safeForUser username, path
    cb new AuthorizationError username
  else
    makedirp path, username, cb

chownr = (options, callback)->
  {path, username, uid, gid} = options
