Add logic for tilde symbol expansion#1233
Add logic for tilde symbol expansion#1233AR-DEV-1 wants to merge 2 commits intoRedot-Engine:masterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds a new OS::expand_path(const String&) API with platform overrides (Unix, Windows) that expand leading tilde (~) to the user home directory; integrates this expansion into FileDialog path inputs and current-path handling. Also tweaks Windows get_unique_id() GUID extraction. Changes
Sequence DiagramsequenceDiagram
actor User
participant FileDialog
participant OS as OS::get_singleton()
participant Platform as "Platform OS\n(Unix / Windows)"
User->>FileDialog: Submit path (e.g., "~/proj")
FileDialog->>OS: expand_path(p_path)
activate OS
OS->>Platform: expand_path(p_path)
activate Platform
Platform->>Platform: if p_path starts with "~", replace with HOME/USERPROFILE
Platform-->>OS: expanded path
deactivate Platform
OS-->>FileDialog: expanded path
deactivate OS
FileDialog->>FileDialog: use expanded path for navigation / file ops
FileDialog-->>User: show files / navigate
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip You can disable sequence diagrams in the walkthrough.Disable the |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scene/gui/file_dialog.cpp`:
- Around line 1229-1237: set_current_dir currently forwards raw input to
_change_dir while set_current_path expands tilde via
OS::get_singleton()->expand_path, causing inconsistent behavior; update
set_current_dir (and any callers like the block in file_dialog.cpp that parses
path into path_dir/path_file and calls set_current_dir) to call
OS::get_singleton()->expand_path on its input before passing to _change_dir so
"~" and other expansions behave consistently with set_current_path and
_change_dir receives an expanded absolute path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0734b4e9-195e-46a3-91f7-7f76b3028075
📒 Files selected for processing (7)
core/os/os.cppcore/os/os.hdrivers/unix/os_unix.cppdrivers/unix/os_unix.hplatform/windows/os_windows.cppplatform/windows/os_windows.hscene/gui/file_dialog.cpp
59a325e to
96af008
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@platform/windows/os_windows.cpp`:
- Around line 2503-2514: In OS_Windows::expand_path, after you prepend
USERPROFILE into path (work with variables path and home in that function),
normalize the separators before returning: convert Windows backslashes to the
engine's canonical '/' form (e.g., replace '\\' with '/'), and ensure any mixed
separators are resolved so expanded results like "~/foo" produce
"C:/Users/me/foo" instead of "C:\Users\me/foo".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 24d21657-42ec-4938-9f79-ed4bf9e31714
📒 Files selected for processing (7)
core/os/os.cppcore/os/os.hdrivers/unix/os_unix.cppdrivers/unix/os_unix.hplatform/windows/os_windows.cppplatform/windows/os_windows.hscene/gui/file_dialog.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- scene/gui/file_dialog.cpp
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Looks good from a review standpoint, I just need to do some testing and we should be good for merge! |
TL;DR
This PR adds the tilde symbol (which is used in UNIX based OS). It checks for your platform & expands the tilde symbol to your home dir (which is
USERPROFILEon Windows &HOMEon Linux).This is a recording of the PR in work:
PR.Showcase.webm
Note
Contributed by 2LazyDevs.
Summary by CodeRabbit
New Features
Bug Fixes