create.py 文件源码

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

项目:siphon-cli 作者: getsiphon 项目源码 文件源码
def copy_app_template(app_name, to_path):
    path = os.path.dirname(os.path.abspath(__file__))
    source_dir = os.path.join(path, '../../../app-template/')
    ignore_func = shutil.ignore_patterns('.DS_Store', 'Thumbs.db')
    shutil.copytree(source_dir, to_path, ignore=ignore_func)

    # Replace the app name placeholder
    index_path = os.path.join(to_path, 'index.js')
    s = open(index_path, 'r').read().replace('{{app_name}}', app_name)
    with open(index_path, 'w') as fp:
        fp.write(s)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号