From 8d948fd2ca11e53c21371d9deef8355ed50c0e76 Mon Sep 17 00:00:00 2001 From: JJJHolscher Date: Thu, 28 Sep 2023 15:11:07 +0200 Subject: [PATCH] file_path --- src/root.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/root.py b/src/root.py index 204a5c0..51d1ec9 100644 --- a/src/root.py +++ b/src/root.py @@ -7,8 +7,8 @@ import __main__ def root_dir(): - if "FILE_NAME" in os.environ: - return Path(os.environ["FILE_NAME"]).parent() + if "FILE_PATH" in os.environ: + return Path(os.environ["FILE_PATH"]).parent() if __main__.__package__: return files(__main__.__package__) @@ -30,8 +30,11 @@ def root_dir(): def root_file(): + if "FILE_PATH" in os.environ: + return Path(os.environ["FILE_PATH"]) + if "FILE_NAME" in os.environ: - return Path(os.environ["FILE_NAME"]) + return root_dir() / os.environ["FILE_NAME"] if "__file__" in dir(__main__): return Path(__main__.__file__)