Skip to content

refactor(gui): extract open_in_file_manager helper using cfg_select!#106

Merged
StudentWeis merged 2 commits into
mainfrom
refactor/extract-open-in-file-manager
May 9, 2026
Merged

refactor(gui): extract open_in_file_manager helper using cfg_select!#106
StudentWeis merged 2 commits into
mainfrom
refactor/extract-open-in-file-manager

Conversation

@StudentWeis
Copy link
Copy Markdown
Owner

Summary

Extract the per-platform "open this directory in the host file manager" logic out of src/gui/panel/settings.rs into a small src/utils/open_path.rs helper, and rewrite the platform dispatch using Rust 1.95's stabilized cfg_select! macro. Pure refactor — no user-visible behavior change on macOS / Windows / Linux.

Linked Issue

Closes #105

Changes

  • Add src/utils/open_path.rs exposing open_in_file_manager(path: &Path), which selects the opener (open / explorer / xdg-open) via cfg_select! with an explicit _ => return fallback for unsupported targets.
  • Register the new module in src/utils.rs.
  • Replace the two duplicated #[cfg(target_os = ...)] blocks in the log_button and config_button on_click handlers in src/gui/panel/settings.rs with a single call to the new helper.

Testing

  • scripts/precheck.sh passes locally (build, clippy, 424 tests, machete, i18n / icons / themes checks all green)
  • New / updated tests cover the change

Self-Check

  • PR title follows Conventional Commits
  • No hardcoded user-facing strings — i18n keys added to all locale files
  • New UI components use gpui-component
  • Errors defined with thiserror (no manual impl Display/Error)
  • No unrelated changes mixed in

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
@StudentWeis StudentWeis merged commit ffda97d into main May 9, 2026
8 checks passed
@StudentWeis StudentWeis deleted the refactor/extract-open-in-file-manager branch May 9, 2026 04:03
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.

refactor: extract open_in_file_manager helper using cfg_select!

1 participant