forked from tpd94/CDRM-Project
Refactor folder checks to improve path handling and add module docstrings for better documentation and clarity
This commit is contained in:
parent
2e520da006
commit
c82d23aabc
@ -1,48 +1,51 @@
|
||||
"""Module to check for the folders."""
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def check_for_config_folder():
|
||||
if os.path.isdir(f"{os.getcwd()}/configs"):
|
||||
return
|
||||
else:
|
||||
os.mkdir(f"{os.getcwd()}/configs")
|
||||
"""Check for the config folder."""
|
||||
if os.path.isdir(os.path.join(os.getcwd(), "configs")):
|
||||
return
|
||||
os.mkdir(os.path.join(os.getcwd(), "configs"))
|
||||
return
|
||||
|
||||
|
||||
def check_for_database_folder():
|
||||
if os.path.isdir(f"{os.getcwd()}/databases"):
|
||||
return
|
||||
else:
|
||||
os.mkdir(f"{os.getcwd()}/databases")
|
||||
os.mkdir(f"{os.getcwd()}/databases/sql")
|
||||
"""Check for the database folder."""
|
||||
if os.path.isdir(os.path.join(os.getcwd(), "databases")):
|
||||
return
|
||||
os.mkdir(os.path.join(os.getcwd(), "databases"))
|
||||
os.mkdir(os.path.join(os.getcwd(), "databases", "sql"))
|
||||
return
|
||||
|
||||
|
||||
def check_for_cdm_folder():
|
||||
if os.path.isdir(f"{os.getcwd()}/configs/CDMs"):
|
||||
return
|
||||
else:
|
||||
os.mkdir(f"{os.getcwd()}/configs/CDMs")
|
||||
"""Check for the CDM folder."""
|
||||
if os.path.isdir(os.path.join(os.getcwd(), "configs", "CDMs")):
|
||||
return
|
||||
os.mkdir(os.path.join(os.getcwd(), "configs", "CDMs"))
|
||||
return
|
||||
|
||||
|
||||
def check_for_wv_cdm_folder():
|
||||
if os.path.isdir(f"{os.getcwd()}/configs/CDMs/WV"):
|
||||
return
|
||||
else:
|
||||
os.mkdir(f"{os.getcwd()}/configs/CDMs/WV")
|
||||
"""Check for the Widevine CDM folder."""
|
||||
if os.path.isdir(os.path.join(os.getcwd(), "configs", "CDMs", "WV")):
|
||||
return
|
||||
os.mkdir(os.path.join(os.getcwd(), "configs", "CDMs", "WV"))
|
||||
return
|
||||
|
||||
|
||||
def check_for_cdm_pr_folder():
|
||||
if os.path.isdir(f"{os.getcwd()}/configs/CDMs/PR"):
|
||||
return
|
||||
else:
|
||||
os.mkdir(f"{os.getcwd()}/configs/CDMs/PR")
|
||||
"""Check for the PlayReady CDM folder."""
|
||||
if os.path.isdir(os.path.join(os.getcwd(), "configs", "CDMs", "PR")):
|
||||
return
|
||||
os.mkdir(os.path.join(os.getcwd(), "configs", "CDMs", "PR"))
|
||||
return
|
||||
|
||||
|
||||
def folder_checks():
|
||||
"""Check for the folders."""
|
||||
check_for_config_folder()
|
||||
check_for_database_folder()
|
||||
check_for_cdm_folder()
|
||||
|
Loading…
x
Reference in New Issue
Block a user