Ver código fonte

Edit mode: fix bug when XDG_DATA_DIRS is empty

upgrade-electron
wpetit 4 anos atrás
pai
commit
b92934fedc
1 arquivos alterados com 11 adições e 3 exclusões
  1. +11
    -3
      src/store/actions/edit.js

+ 11
- 3
src/store/actions/edit.js Ver arquivo

@@ -28,12 +28,20 @@ exports.loadDesktopApps = function() {

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');
});

dispatch({ type: LOAD_DESKTOP_APPS });

return Util.DesktopApps.loadAllDesktopFiles(baseDirs)
.then(function(desktopApps) {
logger.info('Desktop apps loaded.');

Carregando…
Cancelar
Salvar