designspace: normalize platform path separator in getSourcePath
This commit is contained in:
parent
a0e4c04c1e
commit
e640806657
@ -1282,13 +1282,15 @@ class DesignSpaceDocument(LogMixin, AsDictMixin):
|
|||||||
'path' attribute, or if the latter is not set, the concatenation of
|
'path' attribute, or if the latter is not set, the concatenation of
|
||||||
the source's (relative) 'filename' attribute and the designspace's
|
the source's (relative) 'filename' attribute and the designspace's
|
||||||
directory.
|
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
|
Raises DesignSpaceDocumentError if sourceDescriptor.path is None and
|
||||||
self.path is None, or sourceDescriptor.filename is None.
|
self.path is None, or sourceDescriptor.filename is None.
|
||||||
"""
|
"""
|
||||||
if sourceDescriptor.path:
|
if sourceDescriptor.path:
|
||||||
# prefer absolute path if present
|
# prefer absolute path if present
|
||||||
return sourceDescriptor.path
|
return os.path.normpath(sourceDescriptor.path)
|
||||||
if self.path is None:
|
if self.path is None:
|
||||||
raise DesignSpaceDocumentError(
|
raise DesignSpaceDocumentError(
|
||||||
"DesignSpaceDocument 'path' attribute is not defined; cannot "
|
"DesignSpaceDocument 'path' attribute is not defined; cannot "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user