ConvertToUTF8.py 文件源码

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

项目:macos-st-packages 作者: zce 项目源码 文件源码
def clean_temp_folder():
    tmp_files = os.listdir(TMP_DIR)
    for win in sublime.windows():
        for view in win.views():
            file_name = view.file_name()
            tmp_name = get_temp_name(file_name)
            if tmp_name in tmp_files:
                if not view.is_dirty():
                    tmp_file = os.path.join(TMP_DIR, tmp_name)
                    # check mtime
                    mtime1 = os.path.getmtime(file_name)
                    mtime2 = os.path.getmtime(tmp_file)
                    if mtime1 != mtime2:
                        # file was changed outside
                        view.settings().erase('prevent_detect')
                        continue
                    shutil.move(tmp_file, file_name)
                tmp_files.remove(tmp_name)
    for tmp_name in tmp_files:
        tmp_file = os.path.join(TMP_DIR, tmp_name)
        os.unlink(tmp_file)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号