Merge pull request #1011 from atom/no-root-tmp

Do not always use "/tmp" to represent system temporary directory
This commit is contained in:
Cheng Zhao
2013-10-21 17:37:04 -07:00
20 changed files with 115 additions and 63 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

@@ -8,13 +8,14 @@ dialog = require 'dialog'
fs = require 'fs'
ipc = require 'ipc'
path = require 'path'
os = require 'os'
net = require 'net'
shell = require 'shell'
url = require 'url'
{EventEmitter} = require 'events'
_ = require 'underscore-plus'
socketPath = '/tmp/atom.sock'
socketPath = path.join(os.tmpdir(), 'atom.sock')
# Private: The application's singleton class.
#

View File

@@ -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 = '/tmp/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'))

View File

@@ -13,10 +13,12 @@ fsExtensions =
absolute: (relativePath) ->
return null unless relativePath?
homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
if relativePath is '~'
relativePath = process.env.HOME
relativePath = homeDir
else if relativePath.indexOf('~/') is 0
relativePath = "#{process.env.HOME}#{relativePath.substring(1)}"
relativePath = "#{homeDir}#{relativePath.substring(1)}"
try
fs.realpathSync(relativePath)

View File

@@ -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: '/tmp/atom-compile-cache/less'
@cacheDir: path.join(tmpDir, 'atom-compile-cache', 'less')
constructor: ->
@cache = new LessCache