From 2423a7413d04c05cbbf1d9754d3c3ba914ce7a5e Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 3 Jul 2012 15:58:04 -0700 Subject: [PATCH] Storing cached coffeeScript in /tmp because it overwhelms localstorage --- src/stdlib/require.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/stdlib/require.coffee b/src/stdlib/require.coffee index cf760ec5b..46f6fbb55 100644 --- a/src/stdlib/require.coffee +++ b/src/stdlib/require.coffee @@ -106,12 +106,15 @@ __exists = (path) -> __coffeeCache = (filePath) -> {CoffeeScript} = require 'coffee-script' - cacheKey = 'coffee.' + $native.md5ForPath(filePath) - if compiled = localStorage.getItem(cacheKey) - compiled + tmpPath = "/tmp/atom-compiled-scripts" + cacheFilePath = [tmpPath, $native.md5ForPath(filePath)].join("/") + + console.log cacheFilePath + if __exists(cacheFilePath) + __read(cacheFilePath) else compiled = CoffeeScript.compile(__read(filePath), filename: filePath) - localStorage.setItem(cacheKey, compiled) + $native.write(cacheFilePath, compiled) compiled __read = (path) ->