designspace: normalize platform path separator in getSourcePath

This commit is contained in:
Cosimo Lupo 2019-01-02 16:11:32 +00:00
parent a0e4c04c1e
commit e640806657
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482

View File

@ -1282,13 +1282,15 @@ class DesignSpaceDocument(LogMixin, AsDictMixin):
'path' attribute, or if the latter is not set, the concatenation of
the source's (relative) 'filename' attribute and the designspace's
directory.
The returned path uses the platform-specific path separator: i.e.
forward slash on POSIX, backslash on Windows.
Raises DesignSpaceDocumentError if sourceDescriptor.path is None and
self.path is None, or sourceDescriptor.filename is None.
"""
if sourceDescriptor.path:
# prefer absolute path if present
return sourceDescriptor.path
return os.path.normpath(sourceDescriptor.path)
if self.path is None:
raise DesignSpaceDocumentError(
"DesignSpaceDocument 'path' attribute is not defined; cannot "