refactor(gui): extract open_in_file_manager helper using cfg_select!#106
Merged
Conversation
Replace duplicated per-platform #[cfg(target_os = ...)] dispatch in the log/config buttons with a single src/utils/open_path.rs helper that uses Rust 1.95's stable cfg_select! macro. Refs #105
Drop the dedicated src/utils/open_path.rs module — a single ~15 line helper does not warrant its own file. Move the function (still using cfg_select!) into src/utils.rs and update both call sites accordingly. Refs #105
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract the per-platform "open this directory in the host file manager" logic out of
src/gui/panel/settings.rsinto a smallsrc/utils/open_path.rshelper, and rewrite the platform dispatch using Rust 1.95's stabilizedcfg_select!macro. Pure refactor — no user-visible behavior change on macOS / Windows / Linux.Linked Issue
Closes #105
Changes
src/utils/open_path.rsexposingopen_in_file_manager(path: &Path), which selects the opener (open/explorer/xdg-open) viacfg_select!with an explicit_ => returnfallback for unsupported targets.src/utils.rs.#[cfg(target_os = ...)]blocks in thelog_buttonandconfig_buttonon_clickhandlers insrc/gui/panel/settings.rswith a single call to the new helper.Testing
scripts/precheck.shpasses locally (build, clippy, 424 tests, machete, i18n / icons / themes checks all green)Self-Check
gpui-componentthiserror(no manualimpl Display/Error)