INNER CODE UNIT · Python

is_windows

ArcSurge/Termius-Pro-zh_CN · lang.py:55

def is_windows():
    """检测是否为 Windows 系统"""
    return platform.system() == 'Windows'


def _handle_remove_readonly(func, path, _):
    """shutil.rmtree 的错误处理回调:移除只读属性后重试"""
    os.chmod(path, stat.S_IWRITE)
    func(path)


def safe_rmtree(path):
    """安全删除目录,处理只读文件

    Python 3.12+ 使用 onexc,之前版本使用 onerror
    """
    if not os.path.exists(path):
        return

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…