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