37 lines
965 B
JavaScript
37 lines
965 B
JavaScript
var Util = require('../../util');
|
|
var logger = Util.Logger;
|
|
var remote = require('remote');
|
|
|
|
var RUN_APP = exports.RUN_APP = 'RUN_APP';
|
|
var RUN_APP_SUCCESS = exports.RUN_APP_SUCCESS = 'RUN_APP_SUCCESS';
|
|
var RUN_APP_FAILED = exports.RUN_APP_FAILED = 'RUN_APP_FAILED';
|
|
|
|
exports.runApp = function(execPath) {
|
|
|
|
return function(dispatch, getState) {
|
|
|
|
logger.info('Launching app "%s"', execPath);
|
|
|
|
dispatch({ type: RUN_APP, execPath: execPath });
|
|
|
|
return Util.System.runApp(execPath, { clearFreeDesktopFlags: true })
|
|
.then(function() {
|
|
dispatch({ type: RUN_APP_SUCCESS, execPath: execPath });
|
|
// Hypothetical fix
|
|
var win = remote.getCurrentWindow();
|
|
win.show();
|
|
return execPath;
|
|
})
|
|
.catch(function(err) {
|
|
dispatch({ type: RUN_APP_FAILED, error: err });
|
|
// Hypothetical fix
|
|
var win = remote.getCurrentWindow();
|
|
win.show();
|
|
return err;
|
|
})
|
|
;
|
|
|
|
};
|
|
|
|
};
|