Skip to content

Commit

Permalink
v2.2.1: Crack folder selection fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBoiCJ authored Aug 14, 2024
1 parent f9aaeef commit 5efcb05
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions steam_auto_cracker_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from time import sleep
from sys import exit

VERSION = "2.2.0"
VERSION = "2.2.1"

RETRY_DELAY = 15 # Delay in seconds before retrying a failed request. (default, can be modified in config.ini)
RETRY_MAX = 30 # Number of failed tries (includes the first try) after which SAC will stop trying and quit. (default, can be modified in config.ini)
Expand Down Expand Up @@ -71,7 +71,8 @@ def DoRequest(self):
else:
self.req = req

def handle_folder_selection(folder_path=None, event=None):
def handle_folder_selection(event=None):
global folder_path
global last_selected_folder
last_selected_folder = config["Preferences"].get("last_selected_folder", "")
# Reset and hide UI elements related to folder selection and game cracking
Expand All @@ -83,14 +84,15 @@ def reset_folder_selection_ui():

# Determine the folder path based on the event type
if event: # Handling drag and drop
folder_path = event.data.strip("{}").replace("\\", "/") # Returns the directory with no "/" at the end
elif not folder_path: # Handling button click
folder_path_temp = event.data.strip("{}").replace("\\", "/") # Returns the directory with no "/" at the end
else: # Handling button click
initial_dir = "/"
if last_selected_folder != "" and os.path.isdir(last_selected_folder):
initial_dir = last_selected_folder
folder_path = filedialog.askdirectory(initialdir=initial_dir) # Returns the directory with no "/" at the end
folder_path_temp = filedialog.askdirectory(initialdir=initial_dir) # Returns the directory with no "/" at the end

if os.path.isdir(folder_path):
if os.path.isdir(folder_path_temp):
folder_path = folder_path_temp
# Update the last dropped folder for future use
last_selected_folder = os.path.dirname(folder_path) # If no "/" at the end, returns the parent directory
config["Preferences"]["last_selected_folder"] = last_selected_folder
Expand Down

0 comments on commit 5efcb05

Please sign in to comment.