Edit mode: fix bug when XDG_DATA_DIRS is empty
This commit is contained in:
parent
369bcceeb9
commit
b92934fedc
|
@ -28,12 +28,20 @@ exports.loadDesktopApps = function() {
|
||||||
|
|
||||||
logger.info('Loading desktop apps...');
|
logger.info('Loading desktop apps...');
|
||||||
|
|
||||||
var baseDirs = global.process.env.XDG_DATA_DIRS.split(':').map(function(baseDir){
|
dispatch({ type: LOAD_DESKTOP_APPS });
|
||||||
|
|
||||||
|
var xdgDataDirs = global.process.env.XDG_DATA_DIRS;
|
||||||
|
|
||||||
|
if( !xdgDataDirs ) {
|
||||||
|
logger.warn('The environment variable XDG_DATA_DIRS is empty. Can\'t find any application.');
|
||||||
|
dispatch({ type: LOAD_DESKTOP_APPS_SUCCESS, desktopApps: [] });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var baseDirs = xdgDataDirs.split(':').map(function(baseDir){
|
||||||
return path.join(baseDir, 'applications');
|
return path.join(baseDir, 'applications');
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch({ type: LOAD_DESKTOP_APPS });
|
|
||||||
|
|
||||||
return Util.DesktopApps.loadAllDesktopFiles(baseDirs)
|
return Util.DesktopApps.loadAllDesktopFiles(baseDirs)
|
||||||
.then(function(desktopApps) {
|
.then(function(desktopApps) {
|
||||||
logger.info('Desktop apps loaded.');
|
logger.info('Desktop apps loaded.');
|
||||||
|
|
Loading…
Reference in New Issue