From 640b6feb4930204c0b4809a65e21d91f149d786d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 21 Oct 2013 21:59:03 +0800 Subject: [PATCH] :lipstick: The atom object is no accessable in browser process. --- src/coffee-cache.coffee | 4 +++- src/less-compile-cache.coffee | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/coffee-cache.coffee b/src/coffee-cache.coffee index ecf66dc9e..263cd924c 100644 --- a/src/coffee-cache.coffee +++ b/src/coffee-cache.coffee @@ -1,12 +1,14 @@ crypto = require 'crypto' fs = require 'fs' path = require 'path' +os = require 'os' CoffeeScript = require 'coffee-script' CSON = require 'season' mkdir = require('mkdirp').sync -cacheDir = path.join(atom.getTempDirPath(), 'atom-compile-cache') +tmpDir = if process.platform is 'win32' then os.tmpdir() else '/tmp' +cacheDir = path.join(tmpDir, 'atom-compile-cache') coffeeCacheDir = path.join(cacheDir, 'coffee') CSON.setCacheDir(path.join(cacheDir, 'cson')) diff --git a/src/less-compile-cache.coffee b/src/less-compile-cache.coffee index 98c7d45fa..977ede9ff 100644 --- a/src/less-compile-cache.coffee +++ b/src/less-compile-cache.coffee @@ -1,12 +1,15 @@ path = require 'path' +os = require 'os' LessCache = require 'less-cache' {Subscriber} = require 'emissary' +tmpDir = if process.platform is 'win32' then os.tmpdir() else '/tmp' + module.exports = class LessCompileCache Subscriber.includeInto(this) - @cacheDir: path.join(atom.getTempDirPath(), 'atom-compile-cache', 'less') + @cacheDir: path.join(tmpDir, 'atom-compile-cache', 'less') constructor: -> @cache = new LessCache