Merge pull request #5385 from atom/ks-portable
Respect ATOM_HOME env var for portability
Esse commit está contido em:
+1
-1
@@ -6,6 +6,6 @@
|
|||||||
"url": "https://github.com/atom/atom.git"
|
"url": "https://github.com/atom/atom.git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"atom-package-manager": "0.134.0"
|
"atom-package-manager": "0.135.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -75,9 +75,9 @@ elif [ $OS == 'Linux' ]; then
|
|||||||
SCRIPT=$(readlink -f "$0")
|
SCRIPT=$(readlink -f "$0")
|
||||||
USR_DIRECTORY=$(readlink -f $(dirname $SCRIPT)/..)
|
USR_DIRECTORY=$(readlink -f $(dirname $SCRIPT)/..)
|
||||||
ATOM_PATH="$USR_DIRECTORY/share/atom/atom"
|
ATOM_PATH="$USR_DIRECTORY/share/atom/atom"
|
||||||
DOT_ATOM_DIR="$HOME/.atom"
|
ATOM_HOME="${ATOM_HOME:-$HOME/.atom}"
|
||||||
|
|
||||||
mkdir -p "$DOT_ATOM_DIR"
|
mkdir -p "$ATOM_HOME"
|
||||||
|
|
||||||
: ${TMPDIR:=/tmp}
|
: ${TMPDIR:=/tmp}
|
||||||
|
|
||||||
@@ -88,9 +88,9 @@ elif [ $OS == 'Linux' ]; then
|
|||||||
exit $?
|
exit $?
|
||||||
else
|
else
|
||||||
(
|
(
|
||||||
nohup "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$DOT_ATOM_DIR/nohup.out" 2>&1
|
nohup "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
cat "$DOT_ATOM_DIR/nohup.out"
|
cat "$ATOM_HOME/nohup.out"
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
) &
|
) &
|
||||||
|
|||||||
@@ -100,6 +100,14 @@ namespaces: `core` and `editor`.
|
|||||||
|
|
||||||
You can open this file in an editor from the _Atom > Open Your Config_ menu.
|
You can open this file in an editor from the _Atom > Open Your Config_ menu.
|
||||||
|
|
||||||
|
### Custom Configuration Location
|
||||||
|
|
||||||
|
You can override the location that Atom stores configuration files and folders
|
||||||
|
in by setting the `ATOM_HOME` environment variable. The `ATOM_HOME` path will be
|
||||||
|
used instead of `~/.atom` when it is set.
|
||||||
|
|
||||||
|
This option can be useful when you want to make Atom portable across machines.
|
||||||
|
|
||||||
### Configuration Key Reference
|
### Configuration Key Reference
|
||||||
|
|
||||||
- `core`
|
- `core`
|
||||||
|
|||||||
+1
-1
@@ -96,7 +96,7 @@ getCachePath = (sourceCode) ->
|
|||||||
|
|
||||||
unless jsCacheDir?
|
unless jsCacheDir?
|
||||||
to5Version = require('6to5-core/package.json').version
|
to5Version = require('6to5-core/package.json').version
|
||||||
cacheDir = path.join(fs.absolute('~/.atom'), 'compile-cache')
|
cacheDir = path.join(process.env.ATOM_HOME, 'compile-cache')
|
||||||
jsCacheDir = path.join(cacheDir, 'js', '6to5', create6to5VersionAndOptionsDigest(to5Version, defaultOptions))
|
jsCacheDir = path.join(cacheDir, 'js', '6to5', create6to5VersionAndOptionsDigest(to5Version, defaultOptions))
|
||||||
|
|
||||||
path.join(jsCacheDir, "#{digest}.js")
|
path.join(jsCacheDir, "#{digest}.js")
|
||||||
|
|||||||
+1
-4
@@ -109,7 +109,7 @@ class Atom extends Model
|
|||||||
#
|
#
|
||||||
# Returns the absolute path to ~/.atom
|
# Returns the absolute path to ~/.atom
|
||||||
@getConfigDirPath: ->
|
@getConfigDirPath: ->
|
||||||
@configDirPath ?= fs.absolute('~/.atom')
|
@configDirPath ?= process.env.ATOM_HOME
|
||||||
|
|
||||||
# Get the path to Atom's storage directory.
|
# Get the path to Atom's storage directory.
|
||||||
#
|
#
|
||||||
@@ -263,9 +263,6 @@ class Atom extends Model
|
|||||||
# Make react.js faster
|
# Make react.js faster
|
||||||
process.env.NODE_ENV ?= 'production' unless devMode
|
process.env.NODE_ENV ?= 'production' unless devMode
|
||||||
|
|
||||||
# Set Atom's home so packages don't have to guess it
|
|
||||||
process.env.ATOM_HOME = configDirPath
|
|
||||||
|
|
||||||
@config = new Config({configDirPath, resourcePath})
|
@config = new Config({configDirPath, resourcePath})
|
||||||
@keymaps = new KeymapManager({configDirPath, resourcePath})
|
@keymaps = new KeymapManager({configDirPath, resourcePath})
|
||||||
@keymap = @keymaps # Deprecated
|
@keymap = @keymaps # Deprecated
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ class AtomApplication
|
|||||||
PackageManager = require '../package-manager'
|
PackageManager = require '../package-manager'
|
||||||
fs = require 'fs-plus'
|
fs = require 'fs-plus'
|
||||||
@packages = new PackageManager
|
@packages = new PackageManager
|
||||||
configDirPath: fs.absolute('~/.atom')
|
configDirPath: process.env.ATOM_HOME
|
||||||
devMode: devMode
|
devMode: devMode
|
||||||
resourcePath: @resourcePath
|
resourcePath: @resourcePath
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ process.on 'uncaughtException', (error={}) ->
|
|||||||
nslog(error.stack) if error.stack?
|
nslog(error.stack) if error.stack?
|
||||||
|
|
||||||
start = ->
|
start = ->
|
||||||
|
setupAtomHome()
|
||||||
if process.platform is 'win32'
|
if process.platform is 'win32'
|
||||||
SquirrelUpdate = require './squirrel-update'
|
SquirrelUpdate = require './squirrel-update'
|
||||||
squirrelCommand = process.argv[1]
|
squirrelCommand = process.argv[1]
|
||||||
@@ -73,6 +74,18 @@ setupCoffeeScript = ->
|
|||||||
js = CoffeeScript.compile(coffee, filename: filePath)
|
js = CoffeeScript.compile(coffee, filename: filePath)
|
||||||
module._compile(js, filePath)
|
module._compile(js, filePath)
|
||||||
|
|
||||||
|
setupAtomHome = ->
|
||||||
|
return if process.env.ATOM_HOME
|
||||||
|
|
||||||
|
if process.platform is 'win32'
|
||||||
|
home = process.env.USERPROFILE
|
||||||
|
else
|
||||||
|
home = process.env.HOME
|
||||||
|
atomHome = path.join(home, '.atom')
|
||||||
|
try
|
||||||
|
atomHome = fs.realpathSync(atomHome)
|
||||||
|
process.env.ATOM_HOME = atomHome
|
||||||
|
|
||||||
parseCommandLine = ->
|
parseCommandLine = ->
|
||||||
version = app.getVersion()
|
version = app.getVersion()
|
||||||
options = optimist(process.argv[1..])
|
options = optimist(process.argv[1..])
|
||||||
@@ -89,8 +102,12 @@ parseCommandLine = ->
|
|||||||
opened or a new window if it hasn't.
|
opened or a new window if it hasn't.
|
||||||
|
|
||||||
Environment Variables:
|
Environment Variables:
|
||||||
ATOM_DEV_RESOURCE_PATH The path from which Atom loads source code in dev mode.
|
|
||||||
Defaults to `~/github/atom`.
|
ATOM_DEV_RESOURCE_PATH The path from which Atom loads source code in dev mode.
|
||||||
|
Defaults to `~/github/atom`.
|
||||||
|
|
||||||
|
ATOM_HOME The root path for all configuration files and folders.
|
||||||
|
Defaults to `~/.atom`.
|
||||||
"""
|
"""
|
||||||
options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.')
|
options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.')
|
||||||
options.alias('f', 'foreground').boolean('f').describe('f', 'Keep the browser process in the foreground.')
|
options.alias('f', 'foreground').boolean('f').describe('f', 'Keep the browser process in the foreground.')
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ CoffeeScript = require 'coffee-script'
|
|||||||
CSON = require 'season'
|
CSON = require 'season'
|
||||||
fs = require 'fs-plus'
|
fs = require 'fs-plus'
|
||||||
|
|
||||||
cacheDir = path.join(fs.absolute('~/.atom'), 'compile-cache')
|
cacheDir = path.join(process.env.ATOM_HOME, 'compile-cache')
|
||||||
|
|
||||||
stats =
|
stats =
|
||||||
hits: 0
|
hits: 0
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
path = require 'path'
|
path = require 'path'
|
||||||
fs = require 'fs-plus'
|
|
||||||
LessCache = require 'less-cache'
|
LessCache = require 'less-cache'
|
||||||
{Subscriber} = require 'emissary'
|
|
||||||
|
|
||||||
# {LessCache} wrapper used by {ThemeManager} to read stylesheets.
|
# {LessCache} wrapper used by {ThemeManager} to read stylesheets.
|
||||||
module.exports =
|
module.exports =
|
||||||
class LessCompileCache
|
class LessCompileCache
|
||||||
Subscriber.includeInto(this)
|
@cacheDir: path.join(process.env.ATOM_HOME, 'compile-cache', 'less')
|
||||||
|
|
||||||
@cacheDir: path.join(require('./coffee-cache').cacheDir, 'less')
|
|
||||||
|
|
||||||
constructor: ({resourcePath, importPaths}) ->
|
constructor: ({resourcePath, importPaths}) ->
|
||||||
@lessSearchPaths = [
|
@lessSearchPaths = [
|
||||||
@@ -35,5 +31,3 @@ class LessCompileCache
|
|||||||
|
|
||||||
cssForFile: (stylesheetPath, lessContent) ->
|
cssForFile: (stylesheetPath, lessContent) ->
|
||||||
@cache.cssForFile(stylesheetPath, lessContent)
|
@cache.cssForFile(stylesheetPath, lessContent)
|
||||||
|
|
||||||
destroy: -> @unsubscribe()
|
|
||||||
|
|||||||
Referência em uma Nova Issue
Bloquear um usuário