From c54c637ccc65f4f114f3c25e960deac47b69ad6d Mon Sep 17 00:00:00 2001 From: Lamar Pavel Date: Tue, 26 May 2015 12:38:04 +0200 Subject: [PATCH] Class File not transforms relative paths The code from function transform in class UserStyleSheet is now migrated to class File. --- qutebrowser/config/configtypes.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index fb51a4c2e..d0d822a6f 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -802,7 +802,13 @@ class File(BaseType): def transform(self, value): if not value: return None - return os.path.expanduser(value) + value = os.path.expanduser(value) + if not os.path.isabs(value): + if standarddir.config(): + abspath = os.path.join(standarddir.config(), value) + if os.path.isfile(abspath): + return abspath + return value def validate(self, value): if not value: @@ -1155,13 +1161,8 @@ class UserStyleSheet(File): def transform(self, value): if not value: return None - path = os.path.expandvars(value) - path = os.path.expanduser(path) - if not os.path.isabs(path): - if standarddir.config(): - abspath = os.path.join(standarddir.config(), path) - if os.path.isfile(abspath): - path = abspath + path = super().transform(value) + path = os.path.expandvars(path) if os.path.isabs(path): return QUrl.fromLocalFile(path) else: