diff options
-rw-r--r-- | ranger/core/shared.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ranger/core/shared.py b/ranger/core/shared.py index 1d0f96a0..38dc7cdd 100644 --- a/ranger/core/shared.py +++ b/ranger/core/shared.py @@ -17,6 +17,7 @@ inherited, essentially acting like global variables.""" from ranger.ext.lazy_property import lazy_property +import os.path class Awareness(object): pass @@ -54,12 +55,19 @@ class SettingsAware(Awareness): settings.signal_bind('setopt.colorscheme', _colorscheme_name_to_class, priority=1) - def postprocess_paths(signal): + def after_setting_preview_script(signal): if isinstance(signal.value, str): - import os signal.value = os.path.expanduser(signal.value) + if not os.path.exists(signal.value): + signal.value = None settings.signal_bind('setopt.preview_script', - postprocess_paths, priority=1) + after_setting_preview_script, priority=1) + def after_setting_use_preview_script(signal): + if signal.fm.settings.preview_script is None and signal.value: + signal.fm.notify("Preview script undefined or not found!", + bad=True) + settings.signal_bind('setopt.use_preview_script', + after_setting_use_preview_script, priority=1) if not clean: # add the custom options to the list of setting sources |