Fix potential bug with missing path-expansion

The last commit removed two lines in function validate of class
UserStyleSheet that were expanding the path. As it turns out those two
lines are needed by validate as well as transform, so I outsourced them
to the function they both call at that point.
This commit is contained in:
Lamar Pavel 2015-05-22 17:31:37 +02:00
parent 29b25206f6
commit 14ba20670b

View File

@ -1153,6 +1153,8 @@ class UserStyleSheet(File):
super().__init__(none_ok=True) super().__init__(none_ok=True)
def relapath(self, path): def relapath(self, path):
path = os.path.expandvars(path)
path = os.path.expanduser(path)
if not os.path.isabs(path): if not os.path.isabs(path):
abspath = os.path.join(standarddir.config(), path) abspath = os.path.join(standarddir.config(), path)
if os.path.isfile(abspath): if os.path.isfile(abspath):
@ -1160,9 +1162,7 @@ class UserStyleSheet(File):
return path return path
def transform(self, value): def transform(self, value):
path = os.path.expandvars(value) path = self.relapath(value)
path = os.path.expanduser(path)
path = self.relapath(path)
if not value: if not value:
return None return None
elif os.path.isabs(path): elif os.path.isabs(path):