merger.py 文件源码

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

项目:i3config_patcher 作者: David96 项目源码 文件源码
def apply(self, software, theme):
        new_files = theme.files[software]
        files = self.get_supported_software()[software]
        for name, theme_path in new_files.items():
            if name in files:
                for orig_path in files[name]:
                    filename = os.path.expanduser(orig_path)
                    if os.access(filename, os.W_OK):
                        theme.themes.backup_if_necessary(software, name, filename)
                        # reload orig files because the original theme might have
                        # changed (in case a backup was necessary)
                        orig_files = theme.themes.original.files[software]
                        with open(filename, "w") as f:
                            logging.debug("Merging %s with %s" %
                                    (orig_files[name], theme_path))
                            f.writelines(self.merge(software, name,
                                        orig_files[name], theme_path))
                        break
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号