Skip to content

[v3] Fix OpenFileManager on windows - #4375

Merged
leaanthony merged 3 commits into
wailsapp:v3-alphafrom
PPTGamer:v3-alpha-bugfix/open_file_manager
Jul 2, 2025
Merged

leaanthony merged 3 commits into
wailsapp:v3-alphafrom
PPTGamer:v3-alpha-bugfix/open_file_manager

Conversation

@PPTGamer

@PPTGamer PPTGamer commented Jun 24, 2025 •

Copy link
Copy Markdown
Contributor

Description

Fixes bug described in https://discord.com/channels/1042734330029547630/1387077176565960755/1387077176565960755 , where OpenFileManager fails to operate correctly on Windows.

Changes:

  • Use cmd.SysProcAttr.CmdLine to invoke explorer.exe on Windows
  • Separate platform-specific code in package fileexplorer into separate files

Type of change

Please select the option that is relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

If you checked Linux, please specify the distro and version.

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Improved support for opening the file manager on Windows, macOS, and Linux, including the ability to select a specific file where supported.
    • Enhanced compatibility with various Linux desktop environments by detecting and using the default file manager.
  • Bug Fixes

    • Fixed an issue with the OpenFileManager function on Windows.
  • Refactor

    • Simplified and streamlined platform-specific logic for launching the system file manager.

- Use cmd.SysProcAttr.CmdLine to invoke explorer.exe on Windows
- separate platform-specific code in package fileexplorer into separate files
@coderabbitai

coderabbitai Bot commented Jun 24, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The platform-specific logic for opening the file explorer has been refactored from a monolithic implementation into separate files for Darwin (macOS), Linux, and Windows. Each platform now defines its own explorerBinArgs and sysProcAttr functions, streamlining the process and isolating platform-specific behavior.

Changes

File(s) Change Summary
v3/internal/fileexplorer/fileexplorer.go Removed all platform-specific logic; now delegates to per-platform files for explorer command/args and sysProcAttr.
v3/internal/fileexplorer/fileexplorer_darwin.go Added Darwin-specific explorerBinArgs and sysProcAttr implementations for Finder integration.
v3/internal/fileexplorer/fileexplorer_linux.go Added Linux-specific logic for determining file manager executable/args, including desktop file parsing and fallback.
v3/internal/fileexplorer/fileexplorer_windows.go Added Windows-specific explorerBinArgs and sysProcAttr for launching Explorer with optional file selection.
docs/src/content/docs/changelog.mdx Added changelog entry noting a fix for OpenFileManager on Windows credited to @PPTGamer (#4375).

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant fileexplorer (cross-platform)
    participant PlatformSpecific (darwin/linux/windows)
    Caller->>fileexplorer: OpenFileManager(path, selectFile)
    fileexplorer->>PlatformSpecific: explorerBinArgs(path, selectFile)
    PlatformSpecific-->>fileexplorer: bin, args
    fileexplorer->>PlatformSpecific: sysProcAttr(path, selectFile)
    PlatformSpecific-->>fileexplorer: *syscall.SysProcAttr
    fileexplorer->>fileexplorer: exec.CommandContext(bin, args, sysProcAttr)
    fileexplorer-->>Caller: error (if any)
Loading

Possibly related PRs

Suggested labels

v3, size:S

Poem

A hop and a skip, across OS divide,
Explorer commands now neatly reside.
Mac, Linux, and Windows each know their own way,
To open your files without delay.
Rabbits rejoice in this tidy new scheme—
Platform confusion is now but a dream!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b496ef and 98f8998.

📒 Files selected for processing (1)
  • docs/src/content/docs/changelog.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/src/content/docs/changelog.mdx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (windows-latest, 1.24)

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. Bug Something isn't working labels Jun 24, 2025
@PPTGamer PPTGamer changed the title Fix OpenFileManager on windows [v3] Fix OpenFileManager on windows Jun 26, 2025
@leaanthony

Copy link
Copy Markdown
Member

Thanks 🙏 Please could you add an entry to the changelog located at docs/src/content/docs/changelog.mdx? Thanks!

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Jul 1, 2025
@PPTGamer

PPTGamer commented Jul 1, 2025

Copy link
Copy Markdown
Contributor Author

Thanks 🙏 Please could you add an entry to the changelog located at docs/src/content/docs/changelog.mdx? Thanks!

Done!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 2, 2025
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2025

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

@leaanthony
leaanthony enabled auto-merge (squash) July 2, 2025 11:49
@leaanthony
leaanthony disabled auto-merge July 2, 2025 11:49
@leaanthony
leaanthony merged commit 67edf87 into wailsapp:v3-alpha Jul 2, 2025
Etesam913 pushed a commit to Etesam913/wails that referenced this pull request Jul 6, 2025
* Fix OpenFileManager on windows

- Use cmd.SysProcAttr.CmdLine to invoke explorer.exe on Windows
- separate platform-specific code in package fileexplorer into separate files

* Update changelog.mdx

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Grantmartin2002 pushed a commit to Grantmartin2002/wails that referenced this pull request Apr 29, 2026
* Fix OpenFileManager on windows

- Use cmd.SysProcAttr.CmdLine to invoke explorer.exe on Windows
- separate platform-specific code in package fileexplorer into separate files

* Update changelog.mdx

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
@taliesin-ai taliesin-ai added v3 and removed v3-alpha labels Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Documentation Improvements or additions to documentation lgtm This PR has been approved by a maintainer Linux MacOS size:L This PR changes 100-499 lines, ignoring generated files. v3 Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants