Convert target path from Path to str & PurePath
The target path is just read as string from the CLI now, to allow more complex targets (such as URLs) that don't directly map to a path. The Packer subclass now handles the conversion from that string to a `pathlib.PurePath`, and specific subclasses & transfer classes can convert those to a `pathlib.Path` to perform actual filesystem operations when necessary.
This commit is contained in:
@@ -87,25 +87,25 @@ class BlendPathTest(unittest.TestCase):
|
||||
def test_mkrelative(self):
|
||||
self.assertEqual(b'//asset.png', BlendPath.mkrelative(
|
||||
Path('/path/to/asset.png'),
|
||||
Path('/path/to/bfile.blend'),
|
||||
PurePosixPath('/path/to/bfile.blend'),
|
||||
))
|
||||
self.assertEqual(b'//to/asset.png', BlendPath.mkrelative(
|
||||
Path('/path/to/asset.png'),
|
||||
Path('/path/bfile.blend'),
|
||||
PurePosixPath('/path/bfile.blend'),
|
||||
))
|
||||
self.assertEqual(b'//../of/asset.png', BlendPath.mkrelative(
|
||||
Path('/path/of/asset.png'),
|
||||
Path('/path/to/bfile.blend'),
|
||||
PurePosixPath('/path/to/bfile.blend'),
|
||||
))
|
||||
self.assertEqual(b'//../../path/of/asset.png', BlendPath.mkrelative(
|
||||
Path('/path/of/asset.png'),
|
||||
Path('/some/weird/bfile.blend'),
|
||||
PurePosixPath('/some/weird/bfile.blend'),
|
||||
))
|
||||
self.assertEqual(b'//very/very/very/very/very/deep/asset.png', BlendPath.mkrelative(
|
||||
Path('/path/to/very/very/very/very/very/deep/asset.png'),
|
||||
Path('/path/to/bfile.blend'),
|
||||
PurePosixPath('/path/to/bfile.blend'),
|
||||
))
|
||||
self.assertEqual(b'//../../../../../../../../shallow/asset.png', BlendPath.mkrelative(
|
||||
Path('/shallow/asset.png'),
|
||||
Path('/path/to/very/very/very/very/very/deep/bfile.blend'),
|
||||
PurePosixPath('/path/to/very/very/very/very/very/deep/bfile.blend'),
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user