Use forward slashes on all platforms
This commit is contained in:
parent
804ea5c8f9
commit
5140c3d068
@ -4,6 +4,7 @@ from __future__ import print_function, division, absolute_import
|
|||||||
import collections
|
import collections
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import posixpath
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
from mutatorMath.objects.location import biasFromLocations, Location
|
from mutatorMath.objects.location import biasFromLocations, Location
|
||||||
|
|
||||||
@ -969,6 +970,10 @@ class DesignSpaceDocument(object):
|
|||||||
writer = self.writerClass(path, self)
|
writer = self.writerClass(path, self)
|
||||||
writer.write()
|
writer.write()
|
||||||
|
|
||||||
|
def _posixRelativePath(self, otherPath):
|
||||||
|
relative = os.path.relpath(otherPath, os.path.dirname(self.path))
|
||||||
|
return posixpath.join(*relative.split(os.path.sep))
|
||||||
|
|
||||||
def updatePaths(self):
|
def updatePaths(self):
|
||||||
"""
|
"""
|
||||||
Right before we save we need to identify and respond to the following situations:
|
Right before we save we need to identify and respond to the following situations:
|
||||||
@ -1015,11 +1020,11 @@ class DesignSpaceDocument(object):
|
|||||||
# check what the relative path really should be?
|
# check what the relative path really should be?
|
||||||
expectedFilename = None
|
expectedFilename = None
|
||||||
if descriptor.path is not None and self.path is not None:
|
if descriptor.path is not None and self.path is not None:
|
||||||
expectedFilename = os.path.relpath(descriptor.path, os.path.dirname(self.path))
|
expectedFilename = self._posixRelativePath(descriptor.path)
|
||||||
|
|
||||||
# 3
|
# 3
|
||||||
if descriptor.filename is None and descriptor.path is not None and self.path is not None:
|
if descriptor.filename is None and descriptor.path is not None and self.path is not None:
|
||||||
descriptor.filename = os.path.relpath(descriptor.path, os.path.dirname(self.path))
|
descriptor.filename = self._posixRelativePath(descriptor.path)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# 4
|
# 4
|
||||||
@ -1053,13 +1058,13 @@ class DesignSpaceDocument(object):
|
|||||||
if descriptor.filename is not None and not force:
|
if descriptor.filename is not None and not force:
|
||||||
continue
|
continue
|
||||||
if self.path is not None:
|
if self.path is not None:
|
||||||
descriptor.filename = os.path.relpath(descriptor.path, os.path.dirname(self.path))
|
descriptor.filename = self._posixRelativePath(descriptor.path)
|
||||||
if instances:
|
if instances:
|
||||||
for descriptor in self.instances:
|
for descriptor in self.instances:
|
||||||
if descriptor.filename is not None and not force:
|
if descriptor.filename is not None and not force:
|
||||||
continue
|
continue
|
||||||
if self.path is not None:
|
if self.path is not None:
|
||||||
descriptor.filename = os.path.relpath(descriptor.path, os.path.dirname(self.path))
|
descriptor.filename = self._posixRelativePath(descriptor.path)
|
||||||
|
|
||||||
def getFonts(self):
|
def getFonts(self):
|
||||||
# convenience method that delivers the masters and their locations
|
# convenience method that delivers the masters and their locations
|
||||||
|
Loading…
x
Reference in New Issue
Block a user