INNER CODE UNIT · Python

is_macos

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

def is_macos():
    """检测是否为 macOS 系统"""
    return platform.system() == 'Darwin'


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):
    """安全删除目录,处理只读文件

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…