Skip to content

Add option to save default project path#1281

Open
GeneralProtectionFault wants to merge 1 commit into
Redot-Engine:masterfrom
GeneralProtectionFault:prj_default_path
Open

Add option to save default project path#1281
GeneralProtectionFault wants to merge 1 commit into
Redot-Engine:masterfrom
GeneralProtectionFault:prj_default_path

Conversation

@GeneralProtectionFault

@GeneralProtectionFault GeneralProtectionFault commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Currently, every time you create a new project, you have to navigate to the folder you want to create it in each time.
There is a "Recent" folders store that minimizes this pain, but I think this reduces the friction further, by storing the parent folder of the project as the default project path (stored in the editor settings resource file).

It looks like any values that are different from their defaults are already saved in that resource file automatically, but the default project path is never written back to, so it's not included.

This PR will store that path when the user creates the project. I have made it optional, adding a toggle:
image

I've defaulted it to true, but if we decided we wanted false, it can be changed here in /editor/project_manager/project_dialog.cpp (~line 1000, 1015 as of this PR):

btn_save_default_path = memnew(CheckButton);
btn_save_default_path->set_text(TTRC("Save Parent Folder as Default Project Path"));
btn_save_default_path->set_pressed(true); // Set to false here
vbox_project_path->add_child(btn_save_default_path);

I also renamed some variables that were a little confusing/unclear around the affected code.

Summary by CodeRabbit

Summary by CodeRabbit

  • Refactor
    • Updated the Project dialog layout with clearer inputs for project name, project location, and install/extraction destination, including dedicated toggles for “create directory” and “save default parent path.”
    • Improved the create/import/rename/install/duplicate flows to use the new fields with better field focus and consistent path handling.
  • Bug Fixes
    • Enhanced path validation (including handling selected project.godot) and more accurate ZIP destination behavior.
    • Directory-create options now show/hide more reliably based on the current selection.
  • Documentation
    • Refreshed on-dialog guidance/help text.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ee2679ec-5dde-4a5e-868a-258a896a69ec

📥 Commits

Reviewing files that changed from the base of the PR and between a3f9e99 and 264067e.

📒 Files selected for processing (4)
  • editor/project_manager/project_dialog.cpp
  • editor/project_manager/project_dialog.h
  • editor/settings/editor_settings.cpp
  • editor/settings/editor_settings.h
✅ Files skipped from review due to trivial changes (3)
  • editor/settings/editor_settings.cpp
  • editor/settings/editor_settings.h
  • editor/project_manager/project_dialog.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • editor/project_manager/project_dialog.cpp

Walkthrough

ProjectDialog private members are renamed: project_name/project_path/install_path LineEdit* become line_edit_*; container VBoxContainer* become vbox_*; create_dir becomes btn_create_dir; a new btn_save_default_path checkbox is added. The constructor, path validation, browse handlers, ok_pressed, and show_dialog are updated throughout to reference the new names. A new default project path persistence feature stores the chosen path to EditorSettings. EditorSettings documentation is updated to clarify hidden internal settings behavior.

Changes

ProjectDialog UI Refactoring and Default Path Persistence

Layer / File(s) Summary
Header member variable renames and new controls
editor/project_manager/project_dialog.h
Replaces create_dir with btn_create_dir, introduces btn_save_default_path, and renames all VBoxContainer* members to vbox_* and LineEdit* members to line_edit_* prefixes.
Constructor UI layout rebuild and signal wiring
editor/project_manager/project_dialog.cpp
Substantially rewrites the constructor to instantiate vbox_* containers, line_edit_* inputs, btn_create_dir, btn_save_default_path, a renderer help label, and Version Control Metadata label; connects text_changed/text_submitted signals from the new line edits to validation and submission handlers.
Path validation and input helpers
editor/project_manager/project_dialog.cpp
Updates _validate_path() to read from line_edit_* fields, handle MODE_IMPORT project.godot normalization and ZIP install-path extraction, and toggle visibility of btn_create_dir/vbox_install_path containers. Updates _get_target_path(), _set_target_path(), _update_target_auto_dir(), _create_dir_toggled(), and theme icon handling in _notification() to use new line edits and button state.
Browse and path-selection handlers
editor/project_manager/project_dialog.cpp
Updates _browse_project_path(), _browse_install_path(), _project_path_selected(), _install_path_selected(), and _reset_name() to read/write the new line_edit_* fields and use btn_create_dir->is_pressed() for folder-name appending and focus control.
Project creation, installation, and default path persistence
editor/project_manager/project_dialog.cpp
Updates ok_pressed() to source the target path from line_edit_project_path, set application/config/name from line_edit_project_name for new/rename/install/duplicate modes, and derive ZIP install path from line_edit_install_path. Implements btn_save_default_path logic to persist the default project directory to EditorSettings. Updates set_project_name() and set_project_path() setters.
show_dialog mode-specific UI configuration
editor/project_manager/project_dialog.cpp
Rewrites show_dialog() to hide/show btn_create_dir, btn_save_default_path, vbox_project_name, vbox_install_path per dialog mode; disables line_edit_project_path for rename mode; adjusts grab-focus and select-all to target the appropriate line_edit_* field and initializes auto-directory state.
EditorSettings documentation for hidden settings
editor/settings/editor_settings.cpp, editor/settings/editor_settings.h
Extends documentation to clarify that settings prefixed with _ (e.g., _project_manager/...) are hidden from the Editor Settings UI but always persisted to disk, and that projects/-prefixed settings follow the same convention for per-project metadata.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add option to save default project path' accurately describes the main feature introduced in this PR—a new CheckButton toggle for saving the default project path in the project creation dialog.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@editor/project_manager/project_dialog.cpp`:
- Around line 777-782: Remove trailing whitespace from all lines in the code
block containing the btn_save_default_path check and related EditorSettings
calls in the project_dialog.cpp file. Additionally, check and remove trailing
whitespace from lines 891 and lines 1013-1016 as mentioned in the review
comment. Ensure all lines end without any trailing spaces to pass the
static-checks CI validation.
- Around line 778-779: The condition in the if statement checking
btn_save_default_path->is_pressed() currently includes MODE_IMPORT and
MODE_DUPLICATE alongside MODE_NEW and MODE_INSTALL, which may cause the default
project path to be unintentionally overwritten when importing an existing
project from an arbitrary location or duplicating a project into a one-off
folder. If this behavior is not intended and the feature should only apply to
newly created projects, remove MODE_IMPORT and MODE_DUPLICATE from the mode
check, leaving only MODE_NEW and MODE_INSTALL in the condition.
- Around line 1000-1003: The line_edit_project_name LineEdit control is missing
an accessibility name configuration, while similar controls like
line_edit_project_path and line_edit_install_path have accessibility names set.
After creating line_edit_project_name and setting its virtual keyboard and size
flags, add a call to set_accessibility_name() on line_edit_project_name with an
appropriate descriptive name for screen readers, using the same pattern as the
other line edit fields to maintain consistency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: de2ed121-9a25-485d-9ecc-979faa327d96

📥 Commits

Reviewing files that changed from the base of the PR and between 5ea94ef and 0975f9d.

📒 Files selected for processing (2)
  • editor/project_manager/project_dialog.cpp
  • editor/project_manager/project_dialog.h

Comment thread editor/project_manager/project_dialog.cpp Outdated
Comment on lines +778 to +779
if (btn_save_default_path->is_pressed() &&
(mode == MODE_NEW || mode == MODE_IMPORT || mode == MODE_INSTALL || mode == MODE_DUPLICATE)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Confirm MODE_IMPORT/MODE_DUPLICATE should overwrite the default project path.

The PR intent is to remember the parent of a newly created project, but this branch also fires for import and duplicate. Importing an existing project from an arbitrary location (or duplicating into a one-off folder) will silently overwrite the user's configured default_project_path with that unrelated parent. If that's intended, ignore; otherwise consider limiting this to MODE_NEW/MODE_INSTALL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@editor/project_manager/project_dialog.cpp` around lines 778 - 779, The
condition in the if statement checking btn_save_default_path->is_pressed()
currently includes MODE_IMPORT and MODE_DUPLICATE alongside MODE_NEW and
MODE_INSTALL, which may cause the default project path to be unintentionally
overwritten when importing an existing project from an arbitrary location or
duplicating a project into a one-off folder. If this behavior is not intended
and the feature should only apply to newly created projects, remove MODE_IMPORT
and MODE_DUPLICATE from the mode check, leaving only MODE_NEW and MODE_INSTALL
in the condition.

Comment thread editor/project_manager/project_dialog.cpp Outdated
@GeneralProtectionFault

Copy link
Copy Markdown
Contributor Author

Something I just thought of, this doesn't save the state of the actual toggle I added to make this optional. I will look tomorrow, that seems like something I should add.

@GeneralProtectionFault GeneralProtectionFault force-pushed the prj_default_path branch 2 times, most recently from cb51c5e to a3f9e99 Compare June 23, 2026 23:03
@GeneralProtectionFault

Copy link
Copy Markdown
Contributor Author

Ok, to sorta close the loop I opened, this PR now also saves the state of the new toggle as an internal editor setting.

@Arctis-Fireblight Arctis-Fireblight added this to the Redot LTS 26.3 milestone Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants