From abf8e37e0fbf95e1c19a2057828d8463e0cbda4d Mon Sep 17 00:00:00 2001 From: GiuDev Date: Tue, 13 May 2025 10:13:18 +0200 Subject: [PATCH] fix create config.json --- StreamingCommunity/Util/config_json.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/StreamingCommunity/Util/config_json.py b/StreamingCommunity/Util/config_json.py index 82dc1cd..14453dc 100644 --- a/StreamingCommunity/Util/config_json.py +++ b/StreamingCommunity/Util/config_json.py @@ -36,8 +36,13 @@ class ConfigManager: base_path = os.path.dirname(sys.executable) else: - # Use the current directory where the script is executed - base_path = os.getcwd() + + # Get the actual path of the module file + current_file_path = os.path.abspath(__file__) + # Navigate upwards to find the project root + # Assuming this file is in a package structure like StreamingCommunity/Util/config_json.py + # We need to go up 2 levels to reach the project root + base_path = os.path.dirname(os.path.dirname(os.path.dirname(current_file_path))) # Initialize file paths self.file_path = os.path.join(base_path, file_name)