From aae6de1af3a698d84bf0a74bbc3d6c2ceb255a65 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 28 Nov 2014 16:58:45 +0100 Subject: [PATCH] blendfile: ignore built-in fonts also add filepath_absolute, readonly property --- modules/blendfile_path_walker.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/blendfile_path_walker.py b/modules/blendfile_path_walker.py index c2d7112..7fcce14 100644 --- a/modules/blendfile_path_walker.py +++ b/modules/blendfile_path_walker.py @@ -95,6 +95,17 @@ class FPElem: def filepath(self, filepath): self._set_cb(filepath) + @property + def filepath_absolute(self): + filepath = self.filepath + if filepath.startswith(b'//'): + return os.path.join( + self.basedir, + utils.compatpath(filepath[2:]), + ) + else: + return utils.compatpath(filepath) + class FPElem_block_path(FPElem): """ @@ -409,7 +420,8 @@ class FilePath: def _from_block_VF(block, basedir, extra_info, level): if block[b'packedfile']: return - yield FPElem_block_path(basedir, level, (block, b'name')), extra_info + if block[b'name'] != b'': # builtin font + yield FPElem_block_path(basedir, level, (block, b'name')), extra_info @staticmethod def _from_block_SO(block, basedir, extra_info, level):