Merge pull request #2133 from atom/app_dir_api
Implment app.getAppPath API.
This commit is contained in:
commit
e0528655a8
4 changed files with 13 additions and 0 deletions
|
@ -25,6 +25,13 @@ if process.platform is 'darwin'
|
|||
show: bindings.dockShow
|
||||
setMenu: bindings.dockSetMenu
|
||||
|
||||
appPath = null
|
||||
app.setAppPath = (path) ->
|
||||
appPath = path
|
||||
|
||||
app.getAppPath = ->
|
||||
appPath
|
||||
|
||||
# Be compatible with old API.
|
||||
app.once 'ready', -> @emit 'finish-launching'
|
||||
app.terminate = app.quit
|
||||
|
|
|
@ -291,6 +291,7 @@ if (option.file && !option.webdriver) {
|
|||
app.setName(packageJson.name);
|
||||
app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
|
||||
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()));
|
||||
app.setAppPath(packagePath);
|
||||
}
|
||||
|
||||
// Run the app.
|
||||
|
|
|
@ -87,6 +87,7 @@ app.commandLine.appendSwitch 'enable-npapi'
|
|||
# Set the user path according to application's name.
|
||||
app.setPath 'userData', path.join(app.getPath('appData'), app.getName())
|
||||
app.setPath 'userCache', path.join(app.getPath('cache'), app.getName())
|
||||
app.setAppPath packagePath
|
||||
|
||||
# Load the chrome extension support.
|
||||
require './chrome-extension'
|
||||
|
|
|
@ -139,6 +139,10 @@ This method guarantees all `beforeunload` and `unload` handlers are correctly
|
|||
executed. It is possible that a window cancels the quitting by returning
|
||||
`false` in `beforeunload` handler.
|
||||
|
||||
## app.getAppPath()
|
||||
|
||||
Returns the current application directory.
|
||||
|
||||
## app.getPath(name)
|
||||
|
||||
* `name` String
|
||||
|
|
Loading…
Reference in a new issue