mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Use special compile cache when sudo-ing as root
This commit is contained in:
@@ -6,6 +6,11 @@ CSON = require 'season'
|
||||
fs = require 'fs-plus'
|
||||
|
||||
cacheDir = path.join(fs.absolute('~/.atom'), 'compile-cache')
|
||||
|
||||
# Use separate compile cache when sudo'ing as root to avoid permission issues
|
||||
if process.env.USER is 'root' and process.env.SUDO_USER and process.env.SUDO_USER isnt process.env.USER
|
||||
cacheDir = path.join(cacheDir, 'root')
|
||||
|
||||
coffeeCacheDir = path.join(cacheDir, 'coffee')
|
||||
CSON.setCacheDir(path.join(cacheDir, 'cson'))
|
||||
|
||||
@@ -40,11 +45,13 @@ requireCoffeeScript = (module, filePath) ->
|
||||
|
||||
module.exports =
|
||||
cacheDir: cacheDir
|
||||
|
||||
register: ->
|
||||
Object.defineProperty(require.extensions, '.coffee', {
|
||||
writable: false
|
||||
value: requireCoffeeScript
|
||||
})
|
||||
|
||||
addPathToCache: (filePath) ->
|
||||
extension = path.extname(filePath)
|
||||
if extension is '.coffee'
|
||||
|
||||
@@ -8,7 +8,7 @@ module.exports =
|
||||
class LessCompileCache
|
||||
Subscriber.includeInto(this)
|
||||
|
||||
@cacheDir: path.join(atom.getConfigDirPath(), 'compile-cache', 'less')
|
||||
@cacheDir: path.join(require('./coffee-cache').cacheDir, 'less')
|
||||
|
||||
constructor: ({resourcePath, importPaths}) ->
|
||||
@lessSearchPaths = [
|
||||
|
||||
Reference in New Issue
Block a user