forked from natmourajr/SonarAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainConfig.py
31 lines (26 loc) · 1.21 KB
/
mainConfig.py
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
import os
import sys
import platform
CONFIG = dict(osType=platform.system(), LC_ALL="en_US.UTF-8", LANG="en_US.UTF-8")
if CONFIG["osType"] == "Linux":
CONFIG['currentUser'] = os.getenv("USER")
CONFIG["homePath"] = os.getenv("HOME")
elif CONFIG["osType"] == "Windows":
CONFIG['currentUser'] = os.getenv("USERNAME")
CONFIG["homePath"] = os.getenv("UserProfile").replace("\\\\", '\\')
else:
exit(0)
CONFIG["SONAR_WORKSPACE"] = os.path.join(CONFIG["homePath"], "Workspace", "LPS", "SonarAnalysis")
CONFIG["INPUTDATAPATH"] = os.path.join(CONFIG["homePath"], "Public", "Marinha", "Data")
CONFIG["OUTPUTDATAPATH"] = os.path.join(CONFIG["SONAR_WORKSPACE"], "Results")
# Check if the results path exists
if not os.path.exists(CONFIG["OUTPUTDATAPATH"]):
try:
os.mkdir(CONFIG["OUTPUTDATAPATH"])
for package in os.walk(os.path.join(CONFIG["SONAR_WORKSPACE"], "Packages")).next()[1]:
os.mkdir(os.path.join(CONFIG["OUTPUTDATAPATH"], package))
except Exception as ex:
print("Error: {0}".format(ex.message))
# Add the Packages directory to System Path for import
if os.path.join(CONFIG["SONAR_WORKSPACE"]) not in sys.path:
sys.path.append(os.path.join(CONFIG["SONAR_WORKSPACE"]))