Skip to content

Commit f960ea0

Browse files
committed
fix first launch creation folder
1 parent 0bf53b9 commit f960ea0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

dialogs/settings_dialog.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,31 @@ def accept_settings(self):
197197
if 0 <= selected_size_index < len(self.size_options):
198198
_, new_max_src_size_mb = self.size_options[selected_size_index]
199199

200+
# --- Path Creation ---
201+
# If the path does not exist, ask the user to create it
202+
if new_path and not os.path.isdir(new_path):
203+
reply = QMessageBox.question(
204+
self,
205+
"Create Directory?",
206+
f"The path '{new_path}' does not exist.\nDo you want to create it?",
207+
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,
208+
QMessageBox.StandardButton.Yes
209+
)
210+
if reply == QMessageBox.StandardButton.Yes:
211+
try:
212+
os.makedirs(new_path, exist_ok=True)
213+
logging.info(f"Created backup directory: {new_path}")
214+
except OSError as e:
215+
QMessageBox.critical(
216+
self,
217+
"Creation Failed",
218+
f"Failed to create directory '{new_path}'.\n\nError: {e}"
219+
)
220+
return # Stop processing
221+
else:
222+
# User chose not to create. The validation below will fail and show a message.
223+
pass
224+
200225
# --- PATH VALIDATION (Now uses ProfileCreationManager) ---
201226
main_window = self.parent()
202227
# Check if main_window and its profile_creation_manager exist,

0 commit comments

Comments
 (0)