Convert BlendPath to pathlib.Path using local filesystem encoding

UTF-8 is tried first, and if that fails the local filesystem encoding is
used.
This commit is contained in:
Sybren A. Stüvel
2018-03-02 13:42:49 +01:00
parent 8bb130d336
commit 677d388a15
3 changed files with 19 additions and 3 deletions
+1 -2
View File
@@ -59,8 +59,7 @@ class _Tracer:
abspath = lib_block.bfile.abspath(relpath)
# Convert bytes to pathlib.Path object so we have a nice interface to work with.
# This assumes the path is encoded in UTF-8.
path = pathlib.Path(abspath.decode())
path = abspath.to_path()
try:
path = path.resolve()
except FileNotFoundError:
+1 -1
View File
@@ -98,7 +98,7 @@ class BlockUsage:
"""
bpath = self.block.bfile.abspath(self.asset_path)
path = pathlib.Path(bpath.decode())
path = bpath.to_path()
if not self.is_sequence:
if not path.exists():
log.warning('Path %s does not exist for %s', path, self)