ソースを参照

Edit mode: fix bug when XDG_DATA_DIRS is empty

upgrade-electron
wpetit 4年前
コミット
b92934fedc
1個のファイルの変更11行の追加3行の削除
  1. +11
    -3
      src/store/actions/edit.js

+ 11
- 3
src/store/actions/edit.js ファイルの表示

@@ -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.');

読み込み中…
キャンセル
保存