Add atom.getTempDirPath to return the path of "system temporary directory".

This commit is contained in:
Cheng Zhao
2013-10-21 21:39:52 +08:00
parent 05550717e2
commit 558778b4d4
3 changed files with 7 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ remote = require 'remote'
shell = require 'shell'
crypto = require 'crypto'
path = require 'path'
os = require 'os'
dialog = remote.require 'dialog'
app = remote.require 'app'
{Document} = require 'telepath'
@@ -229,7 +230,10 @@ class Atom
@getCurrentWindow().isFullScreen()
getHomeDirPath: ->
app.getHomeDir()
process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
getTempDirPath: ->
if process.platform is 'win32' then os.tmpdir() else '/tmp'
# Public: Get the directory path to Atom's configuration area.
getConfigDirPath: ->

View File

@@ -6,7 +6,7 @@ CoffeeScript = require 'coffee-script'
CSON = require 'season'
mkdir = require('mkdirp').sync
cacheDir = '/tmp/atom-compile-cache'
cacheDir = path.join(atom.getTempDirPath(), 'atom-compile-cache')
coffeeCacheDir = path.join(cacheDir, 'coffee')
CSON.setCacheDir(path.join(cacheDir, 'cson'))

View File

@@ -6,7 +6,7 @@ module.exports =
class LessCompileCache
Subscriber.includeInto(this)
@cacheDir: '/tmp/atom-compile-cache/less'
@cacheDir: path.join(atom.getTempDirPath(), 'atom-compile-cache', 'less')
constructor: ->
@cache = new LessCache