__init__.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:otRebuilder 作者: Pal3love 项目源码 文件源码
def copyFromReader(self, reader, sourcePath, destPath):
        """
        Copy the sourcePath in the provided UFOReader to destPath
        in this writer. The paths must be relative. They may represent
        directories or paths. This uses the most memory efficient
        method possible for copying the data possible.
        """
        if not isinstance(reader, UFOReader):
            raise UFOLibError("The reader must be an instance of UFOReader.")
        fullSourcePath = os.path.join(reader._path, sourcePath)
        if not reader._checkForFile(fullSourcePath):
            raise UFOLibError("No file named \"%s\" to copy from." % sourcePath)
        fullDestPath = os.path.join(self._path, destPath)
        if os.path.exists(fullDestPath):
            raise UFOLibError("A file named \"%s\" already exists." % sourcePath)
        self._buildDirectoryTree(destPath)
        if os.path.isdir(fullSourcePath):
            shutil.copytree(fullSourcePath, fullDestPath)
        else:
            shutil.copy(fullSourcePath, fullDestPath)

    # UFO mod time
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号