diff --git a/index.py b/index.py index 94b61d8..85bd212 100644 --- a/index.py +++ b/index.py @@ -252,9 +252,9 @@ def handle_app_click(app_id): # Check if the thunderenv directory exists in the app directory thunderenv_path = os.path.join(app_dir, "thunderenv") if os.path.exists(thunderenv_path) and os.path.isdir(thunderenv_path): - print("Yes") + print("Thunder environment found.") else: - print("No") + print("Creating Thunder environment...") # Create a virtual environment named "thunderenv" in the app's folder try: venv.create(thunderenv_path, with_pip=True) @@ -262,6 +262,10 @@ def handle_app_click(app_id): except Exception as e: print(f"Error creating virtual environment: {e}") + # Get app_data from the JSON file + with open(os.path.join("data", f"{numeric_app_id}.json"), "r") as f: + app_data = json.load(f) + # Function to start the app def start_app(): try: @@ -269,7 +273,11 @@ def start_app(): app_name = app_id.split('_')[-1] # Construct the path to the main file - main_file_path = os.path.join(app_dir, app_name + ".py") + main_file_name = app_data.get("main_file", "main.py") + main_file_path = os.path.join(app_dir, main_file_name) + + # Debug line to print the path where the script is looking for the main file + print("Looking for main file at:", main_file_path) # Check if the main file exists and if it's a Python file if os.path.exists(main_file_path) and main_file_path.endswith(".py"): @@ -310,6 +318,9 @@ def uninstall_app(): print(f"Error handling app click: {e}") + + + # CallBack function for commenu def commenu_callback(choice):