auto_build_launcher/utils/system_utils.py

34 lines
783 B
Python
Raw Normal View History

2025-07-07 03:27:26 +00:00
import platform
class SystemUtils:
"""系统相关工具类"""
@staticmethod
def is_windows():
"""判断是否为Windows系统"""
return platform.system() == 'Windows'
@staticmethod
def is_linux():
"""判断是否为Linux系统"""
return platform.system() == 'Linux'
@staticmethod
def is_mac():
"""判断是否为macOS系统"""
return platform.system() == 'Darwin'
@staticmethod
def get_platform_name():
"""获取平台名称"""
system = platform.system()
if system == 'Windows':
return 'windows'
elif system == 'Linux':
return 'linux'
elif system == 'Darwin':
return 'mac'
else:
return 'unknown'