From 4ea2e755dbc31e9d8f60bef0bf4877b9b319849c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 23 Jun 2020 23:42:00 -0700 Subject: [PATCH] frontpage: Load shortcuts from .d directories too Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/frontpage.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plinth/frontpage.py b/plinth/frontpage.py index 5e63bff1c..ae1f73f46 100644 --- a/plinth/frontpage.py +++ b/plinth/frontpage.py @@ -160,11 +160,15 @@ def _extract_web_app_url(custom_shortcut): def get_custom_shortcuts(): """Return a merged dictionary of all custom shortcuts.""" - shortcuts_dirs = [cfg.config_dir, cfg.data_dir, cfg.file_root] + dirs = [cfg.config_dir, cfg.data_dir, cfg.file_root] + file_paths = [ + pathlib.Path(dir_) / 'custom-shortcuts.json' for dir_ in dirs + ] + file_paths = cfg.expand_to_dot_d_paths(file_paths) shortcuts = {'shortcuts': []} - for shortcuts_dir in shortcuts_dirs: - file_path = pathlib.Path(shortcuts_dir) / 'custom-shortcuts.json' + for file_path in file_paths: + file_path = pathlib.Path(file_path) if not file_path.is_file() or not file_path.stat().st_size: continue