     mkdirp versionedPath, (err)->
       if err then cb err
       else
-        fs.readFile "#{userAppPath}/index.js", (err, appScript)->
-          if err then cb err
-          else
-            fs.readFile "#{userAppPath}/.manifest", (err, manifest)->
-              if err then cb err
-              else
-                fs.writeFile "#{versionedPath}/index.js", appScript, 'utf-8', (err)->
-                  if err then cb err
-                  else
-                    fs.writeFile "#{versionedPath}/.manifest", manifest, 'utf-8', (err)->
-                      if err then cb err
-                      else
-                        fs.stat latestPath, (err, statObj)->
-                          if err
-                            exec "ln -s #{versionedPath} #{latestPath}", cb
-                          else
-                            if statObj.isSymbolicLink() or statObj.isFile()
-                              exec "rm #{latestPath} && ln -s #{versionedPath} #{latestPath}", cb
-                            else if statObj.isDirectory() and appName.length?
-                              exec "rm -rf #{latestPath} && ln -s #{versionedPath} #{latestPath}", cb
-                            else
-                              cb new KodingError "Something went wrong"
+        exec "cp -r #{userAppPath}/* #{versionedPath}/ && rm #{latestPath} && ln -s #{versionedPath} #{latestPath}", (err, stdout, stderr)->
+          if err or stderr then cb err
+          else cb null
+
+
+    # mkdirp versionedPath, (err)->
+    #   if err then cb err
+    #   else
+    #     fs.readFile "#{userAppPath}/index.js", (err, appScript)->
+    #       if err then cb err
+    #       else
+    #         fs.readFile "#{userAppPath}/.manifest", (err, manifest)->
+    #           if err then cb err
+    #           else
+    #             fs.writeFile "#{versionedPath}/index.js", appScript, 'utf-8', (err)->
+    #               if err then cb err
+    #               else
+    #                 fs.writeFile "#{versionedPath}/.manifest", manifest, 'utf-8', (err)->
+    #                   if err then cb err
+    #                   else
+    #                     fs.stat latestPath, (err, statObj)->
+    #                       if err
+    #                         exec "ln -s #{versionedPath} #{latestPath}", cb
+    #                       else
+    #                         if statObj.isSymbolicLink() or statObj.isFile()
+    #                           exec "rm #{latestPath} && ln -s #{versionedPath} #{latestPath}", cb
+    #                         else if statObj.isDirectory() and appName.length?
+    #                           exec "rm -rf #{latestPath} && ln -s #{versionedPath} #{latestPath}", cb
+    #                         else
+    #                           cb new KodingError "Something went wrong"
 
   installApp: (options, callback)->
 

              log.error "CANT CREATE THIS USER"
              callback?  "[ERROR] unable to get user's UID, can't create user: #{stderr}"

          
      else if stdout < config.minAllowedUid
        stdout = stdout.replace(/(\r\n|\n|\r)/gm," ")
        log.error e = "[ERROR]  min UID for commands is #{config.minAllowedUid}, your #{stdout}"



module.exports = new Kite 'sharedHosting'


  timeout:({timeout}, callback)->
    setTimeout (-> callback null, timeout), timeout

  interval:({interval}, callback)->
    setInterval (-> callback null, interval), interval

  executeCommand: require './executecommand'

  fetchSafeFileName:(options,callback)->
    {filePath}    = options
    original      = filePath+""
