Skip to content

Commit

Permalink
log: add details about how QDT working folder is determined (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Dec 22, 2023
2 parents b32c111 + cbd67fa commit b1c4b4a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions qgis_deployment_toolbelt/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
# logs
logger = logging.getLogger(__name__)

# defaults
DEFAULT_QDT_WORKING_FOLDER = Path.home().joinpath(".cache/qgis-deployment-toolbelt")

# #############################################################################
# ########## Functions #############
# ##################################
Expand All @@ -50,10 +53,24 @@ def get_qdt_working_directory(
Path: path to the QDT working directory
"""
if specific_value:
logger.info(f"QDT working folder - Using the specified value: {specific_value}")
return Path(expandvars(expanduser(specific_value)))
elif getenv("QDT_LOCAL_WORK_DIR"):
return Path(expandvars(expanduser(getenv("QDT_LOCAL_WORK_DIR"))))
elif qdt_local_working_folder := getenv("QDT_LOCAL_WORK_DIR"):
logger.info(
"QDT working folder - Using value specified as environment variable: "
f"{qdt_local_working_folder}"
)
return Path(expandvars(expanduser(qdt_local_working_folder)))
else:
if identifier:
logger.info(
f"QDT working folder - Using default path '{DEFAULT_QDT_WORKING_FOLDER}' "
f"with custom identifier '{identifier}'"
)
else:
logger.info(
f"QDT working folder - Using default path: {DEFAULT_QDT_WORKING_FOLDER}"
)
return Path(
expandvars(
expanduser(
Expand Down

0 comments on commit b1c4b4a

Please sign in to comment.