27 lines
761 B
Python
27 lines
761 B
Python
import os
|
|
import toml
|
|
|
|
baseDir = "/airwatchConnector"
|
|
logDir = f"{baseDir}/logs"
|
|
confDir = f"{baseDir}/conf"
|
|
confFiles = os.listdir(confDir)
|
|
|
|
# On récupère que les fichiers .conf
|
|
confFiles = [conf for conf in confFiles if os.path.isfile(f"{confDir}/{conf}") and not conf.endswith(".conf")]
|
|
|
|
for conf in confFiles:
|
|
# On forme un nom à partir du nom du fichier de conf sans l'extension
|
|
# et on enlève les espaces
|
|
confName = conf[:5].replace(' ', '')
|
|
|
|
with open(f"{confDir}/{conf}", "r") as f:
|
|
settings = toml.load(f)
|
|
|
|
# Create log folder
|
|
if(settings["LOGS"]["Enabled"]):
|
|
logPath = settings["LOGS"].get(Path)
|
|
if not os.path.exists(f"{logDir}/{logPath}"):
|
|
os.makedirs(f"{logDir}/{logPath}")
|
|
|
|
|