Implement app.getHomeDir with app.getPath
This commit is contained in:
parent
d31df439c3
commit
a988b48016
2 changed files with 5 additions and 9 deletions
|
@ -67,6 +67,8 @@ int GetPathConstant(const std::string& name) {
|
|||
return brightray::DIR_APP_DATA;
|
||||
else if (name == "userData")
|
||||
return brightray::DIR_USER_DATA;
|
||||
else if (name == "home")
|
||||
return base::DIR_HOME;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -5,15 +5,6 @@ bindings = process.atomBinding 'app'
|
|||
app = bindings.app
|
||||
app.__proto__ = EventEmitter.prototype
|
||||
|
||||
app.getHomeDir = ->
|
||||
process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
|
||||
|
||||
app.getDataPath = ->
|
||||
app.getPath 'userData'
|
||||
|
||||
app.setDataPath = (path) ->
|
||||
app.setPath 'userData', path
|
||||
|
||||
app.setApplicationMenu = (menu) ->
|
||||
require('menu').setApplicationMenu menu
|
||||
|
||||
|
@ -38,6 +29,9 @@ if process.platform is 'darwin'
|
|||
app.once 'ready', -> app.emit 'finish-launching'
|
||||
app.terminate = app.quit
|
||||
app.exit = process.exit
|
||||
app.getHomeDir = -> app.getPath 'home'
|
||||
app.getDataPath = -> app.getPath 'userData'
|
||||
app.setDataPath = (path) -> app.setPath 'userData', path
|
||||
|
||||
# Only one App object pemitted.
|
||||
module.exports = app
|
||||
|
|
Loading…
Reference in a new issue