34 lines
		
	
	
		
			783 B
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			783 B
		
	
	
	
		
			Python
		
	
	
	
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'
 |