-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSystemHelper.py
More file actions
64 lines (46 loc) · 1.54 KB
/
SystemHelper.py
File metadata and controls
64 lines (46 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from pathlib import Path
import platform
from Logger.Logger import *
class SystemHelper():
__instance = None
def __new__(cls, *args, **kwargs):
if not cls.__instance:
cls.__instance = super().__new__(cls, *args, **kwargs)
return cls.__instance
def Get():
return SystemHelper()
def GetHostPlatform(self):
ossystem = platform.platform().lower()
if 'windows' in ossystem:
return SystemHelper.Win_HostName()
elif 'macos' in ossystem:
return SystemHelper.Mac_HostName()
else:
PrintErr("HostPlatform [%s] currently is not supported" %(str(ossystem)))
return "NotSupportPlatform"
def GetHostPlatformArchitechture(self):
## arm64 x86_64
return platform.machine().lower()
def GetTargetPlatform_BasedOnHostPlatform(self):
platform = self.GetHostPlatform()
if platform == SystemHelper.Win_HostName():
platform = SystemHelper.Win64_TargetName()
return platform
## Host Platforms
def Win_HostName():
return "Win"
def Mac_HostName():
return "Mac"
## ====== Target Platforms ======
def Win64_TargetName():
return "Win64"
def Mac_TargetName():
return "Mac"
def IOS_TargetName():
return "IOS"
def Android_TargetName():
return "Android"
## Win_SpecialRequestName() if needed
def Win_InArgsTargetName():
## In Args: Win64 == Win
return "Win"