Skip to content

Conversation

onesounds
Copy link
Contributor

@onesounds onesounds commented May 20, 2025

Improve File Manager Configuration Error Handling



Summary

Details

  • The default executable path for Files has changed from Files to Files-stable. The default setting has been adjusted accordingly.
  • Since the path may vary depending on the installed version, a note has been added to explain this. Additionally, warnings will be shown if the user tries to add or use an invalid path.
  • Migration logic was considered, but due to complexity and edge cases, it was not implemented.

Future

  • In the future, it would be helpful to create a dedicated webpage where users can share configuration examples for various file managers.

Test

  • A warning popup should appear when attempting to register a file manager with a non-existent path.

  • An error message should be shown when trying to open a folder using a file manager that was registered with a non-existent path.

@prlabeler prlabeler bot added the bug Something isn't working label May 20, 2025

This comment has been minimized.

Copy link

gitstream-cm bot commented May 20, 2025

🥷 Code experts: Jack251970

Jack251970, onesounds have most 👩‍💻 activity in the files.
onesounds, Jack251970 have most 🧠 knowledge in the files.

See details

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 41 additions & 19 deletions
APR 34 additions & 83 deletions 104 additions & 38 deletions
MAR 142 additions & 94 deletions 10 additions & 0 deletions
FEB 10 additions & 4 deletions
JAN 17 additions & 4 deletions
DEC 1 additions & 1 deletions

Knowledge based on git-blame:
Jack251970: 26%
onesounds: 21%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Jack251970 onesounds
MAY 11 additions & 0 deletions
APR 22 additions & 21 deletions 45 additions & 23 deletions
MAR 67 additions & 42 deletions 8 additions & 3 deletions
FEB 15 additions & 9 deletions
JAN 1 additions & 0 deletions
DEC

Knowledge based on git-blame:
onesounds: 42%
Jack251970: 11%

Flow.Launcher/PublicAPIInstance.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 97 additions & 51 deletions 45 additions & 21 deletions
APR 165 additions & 61 deletions
MAR 21 additions & 19 deletions
FEB 28 additions & 11 deletions
JAN 45 additions & 47 deletions
DEC 25 additions & 32 deletions

Knowledge based on git-blame:
Jack251970: 52%
onesounds: 2%

Flow.Launcher/SelectFileManagerWindow.xaml

Activity based on git-commit:

Jack251970 onesounds
MAY
APR 1 additions & 1 deletions 1 additions & 1 deletions
MAR
FEB 1 additions & 4 deletions
JAN
DEC

Knowledge based on git-blame:
onesounds: 95%

Flow.Launcher/SelectFileManagerWindow.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
MAY
APR 18 additions & 35 deletions 16 additions & 0 deletions
MAR
FEB
JAN
DEC

Knowledge based on git-blame:
onesounds: 31%
Jack251970: 23%

To learn more about /:\ gitStream - Visit our Docs

Copy link

gitstream-cm bot commented May 20, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copy link
Contributor

coderabbitai bot commented May 20, 2025

📝 Walkthrough

"""

Walkthrough

This update modifies the default configuration for the "Files" file manager in user settings, enhances error handling and user feedback when opening directories with custom file managers, adds new UI elements and validation in the file manager selection window, and introduces new English localization strings related to file manager configuration and errors.

Changes

File(s) Change Summary
Flow.Launcher.Infrastructure/UserSettings/Settings.cs Changed the default "Files" entry in CustomExplorerList: updated Path from "Files" to "Files-Stable" and modified DirectoryArgument to "%d" (removed -select).
Flow.Launcher/Languages/en.xaml Added new localized strings for file manager buttons, tooltips, error messages, and tips regarding file manager configuration and errors.
Flow.Launcher/PublicAPIInstance.cs Refactored OpenDirectory to include robust try-catch error handling, display user-friendly error messages, and consolidate process launch logic for both default and custom file managers.
Flow.Launcher/SelectFileManagerWindow.xaml Added a tips button, new separator lines, and adjusted layout/margins in the file manager selection window UI.
Flow.Launcher/SelectFileManagerWindow.xaml.cs Refactored to use SelectFileManagerViewModel via DI, removed direct settings manipulation; added hyperlink navigation handler and simplified file dialog usage.
Flow.Launcher/SelectBrowserWindow.xaml Replaced code-behind event handlers with MVVM command bindings; changed DataContext to design-time SelectBrowserViewModel.
Flow.Launcher/SelectBrowserWindow.xaml.cs Refactored to use SelectBrowserViewModel via DI, removed direct settings and collection management, simplified event handlers to delegate to ViewModel.
Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs Added SelectFileManagerViewModel managing file manager profiles with validation, add/delete commands, save logic, and a command to show tips dialog with hyperlink.
Flow.Launcher/ViewModel/SelectBrowserViewModel.cs Added SelectBrowserViewModel managing custom browser profiles with add/delete commands and save logic.
Flow.Launcher/App.xaml.cs Registered SelectBrowserViewModel and SelectFileManagerViewModel as transient services in DI container.
Flow.Launcher/MessageBoxEx.xaml.cs Removed the simpler Show(string) overload, retaining only the comprehensive Show method with multiple parameters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SelectFileManagerWindow
    participant PublicAPIInstance
    participant OS

    User->>SelectFileManagerWindow: Clicks "Done" after choosing file manager
    SelectFileManagerWindow->>SelectFileManagerWindow: Validate file manager path
    alt Invalid path
        SelectFileManagerWindow->>User: Show warning dialog
        User->>SelectFileManagerWindow: Confirm or cancel
        alt User cancels
            SelectFileManagerWindow-->>User: Cancel save
        else User confirms
            SelectFileManagerWindow->>PublicAPIInstance: Save and continue
        end
    else Valid path
        SelectFileManagerWindow->>PublicAPIInstance: Save and continue
    end

    User->>PublicAPIInstance: Request to open directory
    PublicAPIInstance->>OS: Attempt to launch file manager
    alt File manager not found
        PublicAPIInstance->>User: Show "file manager not found" error
    else Other error
        PublicAPIInstance->>User: Show generic error with details
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Fix error when opening folder with "Files" file explorer (issue #3217)
Provide user feedback and error handling for missing or invalid file manager paths (issue #3217)
Validate file manager path before saving in settings (issue #3217)

Suggested labels

Documentation

Suggested reviewers

  • onesounds
  • taooceros

Poem

A bunny hopped through settings bright,
Tweaked "Files" to launch just right.
With buttons, tips, and error cues,
No more explorer path taboos!
Now folders open without a scare—
A happy rabbit, software fair.
🐇✨
"""

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2d50cd and 41b9cd4.

📒 Files selected for processing (3)
  • Flow.Launcher/SelectBrowserWindow.xaml.cs (2 hunks)
  • Flow.Launcher/ViewModel/SelectBrowserViewModel.cs (1 hunks)
  • Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • Flow.Launcher/ViewModel/SelectBrowserViewModel.cs
  • Flow.Launcher/SelectBrowserWindow.xaml.cs
  • Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Contributor

coderabbitai bot commented May 20, 2025

📝 Walkthrough

Walkthrough

This update modifies the default configuration for the "Files" file explorer, adds new localized UI strings and error messages related to file manager selection, and introduces improved validation and error handling when users select or invoke a custom file manager. The UI for selecting a file manager is enhanced with a new tips button and clearer separation.

Changes

File(s) Change Summary
Flow.Launcher.Infrastructure/UserSettings/Settings.cs Updated default "Files" explorer entry: changed Path to "Files-Stable" and altered DirectoryArgument to "%d".
Flow.Launcher/Languages/en.xaml Added new string resources for file manager tips, error messages, and UI labels related to file manager configuration and errors.
Flow.Launcher/PublicAPIInstance.cs Wrapped directory opening logic in try-catch; added user-facing error dialogs for missing file manager and general open failures.
Flow.Launcher/SelectFileManagerWindow.xaml Added a tips button, separator lines, and adjusted layout/margins for improved UI clarity in the file manager selection window.
Flow.Launcher/SelectFileManagerWindow.xaml.cs Added file manager path validation on save, warning dialog on invalid input, and a new tips dialog with hyperlink; added event handler logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SelectFileManagerWindow
    participant System

    User->>SelectFileManagerWindow: Clicks "Done"
    SelectFileManagerWindow->>SelectFileManagerWindow: IsFileManagerValid(path)
    alt Path invalid
        SelectFileManagerWindow->>User: Show warning dialog (Yes/No)
        alt User selects No
            SelectFileManagerWindow-->>User: Cancel save
        else User selects Yes
            SelectFileManagerWindow->>System: Proceed to save
        end
    else Path valid
        SelectFileManagerWindow->>System: Save file manager selection
    end
Loading
sequenceDiagram
    participant User
    participant PublicAPIInstance
    participant System

    User->>PublicAPIInstance: OpenDirectory(path, file)
    PublicAPIInstance->>System: Try to start process
    alt Success
        System-->>User: Opens directory or file
    else Win32Exception (file not found)
        PublicAPIInstance->>User: Show "file manager not found" dialog
    else Other exception
        PublicAPIInstance->>User: Show "folder open error" dialog
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Fix error when opening folders/files with "Files" file explorer (Issue #3217)
Provide user feedback when custom file manager is not found or fails to open (Issue #3217)
Validate file manager path and warn user on invalid selection (Issue #3217)

Possibly related PRs

  • Support QTTabBar #2803: Adds a new custom explorer entry for QTTabBar and extends OpenDirectory for custom file managers, directly related to changes in custom file explorer configuration and usage.

Suggested labels

kind/ui

Suggested reviewers

  • onesounds
  • jjw24

Poem

A rabbit hopped through folders wide,
But "Files" explorer failed to guide.
With tips and checks now in the mix,
No more errors, just quick picks!
Hooray for code that helps us see—
A smoother hop through directory! 🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (2)

72-105: Comprehensive file manager path validation implementation.

The validation logic is thorough, checking for multiple valid path scenarios:

  1. The built-in Explorer
  2. Full paths to existing executables
  3. Commands available in the system PATH

While the implementation works well, consider adding a simple cache for PATH lookups to avoid running the where command repeatedly if the validation is called multiple times for the same path.

+        private static readonly Dictionary<string, bool> _pathValidationCache = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);

         private bool IsFileManagerValid(string path)
         {
             if (string.Equals(path, "explorer", StringComparison.OrdinalIgnoreCase))
                 return true;
             
             if (Path.IsPathRooted(path))
             {
                 return File.Exists(path);
             }

+            // Check cache first
+            if (_pathValidationCache.TryGetValue(path, out bool isValid))
+                return isValid;

             try
             {
                 var process = new Process
                 {
                     StartInfo = new ProcessStartInfo
                     {
                         FileName = "where",
                         Arguments = path,
                         RedirectStandardOutput = true,
                         UseShellExecute = false,
                         CreateNoWindow = true
                     }
                 };
                 process.Start();
                 string output = process.StandardOutput.ReadToEnd();
                 process.WaitForExit();

-                return !string.IsNullOrEmpty(output);
+                isValid = !string.IsNullOrEmpty(output);
+                _pathValidationCache[path] = isValid;
+                return isValid;
             }
             catch
             {
+                _pathValidationCache[path] = false;
                 return false;
             }
         }
🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 125-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-44: hyperlink is not a recognized word. (unrecognized-spelling)


167-175: Consider adding file type filtering to the file browser dialog.

When browsing for file manager executables, the dialog doesn't limit selection to executable files, which could lead users to select invalid files.

         private void btnBrowseFile_Click(object sender, RoutedEventArgs e)
         {
             Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
+            dlg.Filter = "Executable files (*.exe)|*.exe|All files (*.*)|*.*";
+            dlg.Title = (string)Application.Current.FindResource("fileManager_select_title");
             var result = dlg.ShowDialog();
             if (result == true)
             {
                 TextBox path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox");
                 path.Text = dlg.FileName;
                 path.Focus();
                 ((Button)sender).Focus();
             }
         }
Flow.Launcher/Languages/en.xaml (3)

369-370: Improve clarity of the “Files” button label and tooltip
The button label and tooltip can be more descriptive and concise. For example, “Do you use Files?” could read “Use the Files file manager?” and the tooltip can remove redundant parentheses.

-    <system:String x:Key="fileManager_files_btn">Do you use Files?</system:String>
-    <system:String x:Key="fileManager_files_tips">Depending on the version, Files may use either "Files" or "Files-stable" as its path. (This can vary depending on which version you're using.) For more details, see:</system:String>
+    <system:String x:Key="fileManager_files_btn">Use the Files file manager?</system:String>
+    <system:String x:Key="fileManager_files_tips">Depending on your version, the Files file manager may use either "Files" or "Files-stable" as its executable name. For more details, see:</system:String>

378-379: Add sentence separation in path-not-found message
The current message merges two sentences without proper punctuation. It should end the first sentence after {1}.

-    <system:String x:Key="fileManagerPathNotFound">The path for the file manager '{0}' could not be found: '{1}' Do you want to continue?</system:String>
+    <system:String x:Key="fileManagerPathNotFound">The path for the file manager '{0}' could not be found: '{1}'. Do you want to continue?</system:String>

The accompanying title string fileManagerPathError looks correct.


470-475: Fix spacing and consistency in File Open Error strings

  • Add a space in “Settings > General”.
  • Ensure naming and capitalization align with other dialogs.
-    <system:String x:Key="fileManagerNotFound">The specified file manager could not be found. Please check the Custom File Manager setting under Settings >General.</system:String>
+    <system:String x:Key="fileManagerNotFound">The specified file manager could not be found. Please check the Custom File Manager setting under Settings > General.</system:String>

The titles fileManagerNotFoundTitle ("File Manager Error"), errorTitle ("Error"), and the folderOpenError message are otherwise clear.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4a3e06 and aadfde0.

📒 Files selected for processing (5)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1 hunks)
  • Flow.Launcher/Languages/en.xaml (2 hunks)
  • Flow.Launcher/PublicAPIInstance.cs (1 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml (2 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml.cs (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (1)
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
🪛 GitHub Actions: Check Spelling
Flow.Launcher/PublicAPIInstance.cs

[warning] 45-46: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 49-52: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 145-74: VSTHRD is not a recognized word. (unrecognized-spelling)

Flow.Launcher/SelectFileManagerWindow.xaml.cs

[warning] 125-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-44: hyperlink is not a recognized word. (unrecognized-spelling)

Flow.Launcher/SelectFileManagerWindow.xaml

[warning] 125-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-44: hyperlink is not a recognized word. (unrecognized-spelling)

🪛 GitHub Check: Check Spelling
Flow.Launcher/SelectFileManagerWindow.xaml.cs

[warning] 136-136:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-126:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 125-125:
hyperlink is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (7)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1)

229-231: Updated default configuration for Files file manager.

The path for the "Files" file manager has been updated from "Files" to "Files-Stable" and the directory argument has been simplified. This aligns with changes in the Files app mentioned in the PR objectives.

Flow.Launcher/PublicAPIInstance.cs (1)

319-375: Improved error handling with user-friendly messages.

The OpenDirectory method now properly handles different failure scenarios when opening directories or files using custom file managers, providing clear and localized error messages to the user.

The implementation correctly:

  1. Distinguishes between file manager not found errors and other exceptions
  2. Uses localized error messages for better user experience
  3. Shows appropriate message boxes with relevant information
Flow.Launcher/SelectFileManagerWindow.xaml (3)

76-82: Added helpful tips button for file manager configuration.

This addition improves user experience by providing easy access to important information about file manager configuration.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 125-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-44: hyperlink is not a recognized word. (unrecognized-spelling)


83-87: Improved UI organization with visual separators.

The added separator and adjusted margins create better visual distinction between different sections of the UI, making it more intuitive to use.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 125-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-44: hyperlink is not a recognized word. (unrecognized-spelling)


123-123: Standardized separator styling.

Updated the fill color to use the standard SeparatorForeground resource for consistency across the UI.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 125-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-44: hyperlink is not a recognized word. (unrecognized-spelling)

Flow.Launcher/SelectFileManagerWindow.xaml.cs (2)

51-65: Added validation for file manager path with user warning.

This important validation check alerts users when they've configured an invalid file manager path, while still allowing them to proceed if they choose to. This directly addresses the PR objective of enhancing feedback when a file manager path is invalid.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 125-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-44: hyperlink is not a recognized word. (unrecognized-spelling)


107-149: Added informative tips dialog with external resource link.

The implementation creates a well-designed dialog with a clickable hyperlink to external documentation, which helps users understand the "Files" file manager variants mentioned in the PR objectives.

The ContentDialog provides a modern UI experience, and the hyperlink implementation correctly uses the system browser to open the URL.

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 136-136:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-126:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 125-125:
hyperlink is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 125-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 126-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-44: hyperlink is not a recognized word. (unrecognized-spelling)

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (1)

117-159: Consider reusing the hyperlink navigation logic.

The hyperlink navigation code in this method duplicates the functionality you already implemented in the Hyperlink_RequestNavigate method. Consider reusing that method to reduce duplication.

- hyperlink.RequestNavigate += (s, args) =>
- {
-     Process.Start(new ProcessStartInfo
-     {
-         FileName = args.Uri.AbsoluteUri,
-         UseShellExecute = true
-     });
-     args.Handled = true;
- };
+ hyperlink.RequestNavigate += Hyperlink_RequestNavigate;
🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 146-146:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-136:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-135:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 131-131:
hyperlink is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 131-32: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 146-44: hyperlink is not a recognized word. (unrecognized-spelling)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aadfde0 and 3fa9259.

📒 Files selected for processing (3)
  • Flow.Launcher/Languages/en.xaml (2 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml (2 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml.cs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • Flow.Launcher/SelectFileManagerWindow.xaml
  • Flow.Launcher/Languages/en.xaml
🧰 Additional context used
🧠 Learnings (1)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (1)
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
🪛 GitHub Check: Check Spelling
Flow.Launcher/SelectFileManagerWindow.xaml.cs

[warning] 146-146:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-136:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-135:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 131-131:
hyperlink is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling
Flow.Launcher/SelectFileManagerWindow.xaml.cs

[warning] 131-32: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 146-44: hyperlink is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (4)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (4)

49-57: Well-implemented hyperlink navigation handler.

The Hyperlink_RequestNavigate method correctly handles URL navigation using ProcessStartInfo with UseShellExecute=true. This is the proper way to open URLs in the default browser.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 131-32: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 146-44: hyperlink is not a recognized word. (unrecognized-spelling)


61-75: Good file manager validation with user-friendly feedback.

This validation logic nicely implements the PR objective of improving error handling and user feedback when a file manager path is invalid. The use of localized strings for the dialog is a good practice for internationalization.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 131-32: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 146-44: hyperlink is not a recognized word. (unrecognized-spelling)


82-115: Thorough path validation implementation.

The IsFileManagerValid method effectively handles all scenarios:

  1. Case-insensitive check for "explorer"
  2. Verification of absolute file paths
  3. Commands available in the system PATH

The error handling for the "where" command execution is appropriate.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 131-32: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 146-44: hyperlink is not a recognized word. (unrecognized-spelling)


1-15: Appropriate namespace additions.

The added namespaces are necessary for the new functionality:

  • System.Diagnostics: For Process-related operations
  • System.IO: For file/path operations
  • System.Windows.Documents: For hyperlink functionality
  • ModernWpf.Controls: For modern WPF dialog controls

This comment has been minimized.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (2)

61-75: The validation logic looks good, but the message could be clearer.

The code correctly validates the file manager path and shows a warning if it's invalid. However, the Yes/No message might not clearly communicate what each option means to the user.

Consider modifying the message to explicitly state what happens with each choice, for example:

var result = App.API.ShowMsgBox(
-   string.Format((string)Application.Current.FindResource("fileManagerPathNotFound"), 
-       CustomExplorer.Name, CustomExplorer.Path),
+   string.Format((string)Application.Current.FindResource("fileManagerPathNotFound") + 
+       "\n\nYes = Save anyway\nNo = Cancel and return to edit", 
+       CustomExplorer.Name, CustomExplorer.Path),
    (string)Application.Current.FindResource("fileManagerPathError"),
    MessageBoxButton.YesNo,
    MessageBoxImage.Warning);
🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 131-32: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 146-44: hyperlink is not a recognized word. (unrecognized-spelling)


82-115: Comprehensive validation but consider adding a timeout for the process execution.

The validation method is well-implemented with checks for Windows Explorer, rooted paths, and commands in PATH. However, the process execution doesn't have a timeout, which could cause the UI to become unresponsive if the where command takes too long to complete.

try
{
    var process = new Process
    {
        StartInfo = new ProcessStartInfo
        {
            FileName = "where",
            Arguments = path,
            RedirectStandardOutput = true,
            UseShellExecute = false,
            CreateNoWindow = true
        }
    };
    process.Start();
+   
+   // Add timeout to prevent UI hanging
+   bool exited = process.WaitForExit(3000); // 3 second timeout
+   if (!exited)
+   {
+       process.Kill();
+       return false;
+   }
+   
    string output = process.StandardOutput.ReadToEnd();
-   process.WaitForExit();

    return !string.IsNullOrEmpty(output);
}

Also consider handling paths with arguments (e.g., "notepad.exe C:\file.txt") by extracting just the executable part for validation.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 131-32: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 146-44: hyperlink is not a recognized word. (unrecognized-spelling)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3fa9259 and 3beb4e9.

📒 Files selected for processing (3)
  • Flow.Launcher/MessageBoxEx.xaml.cs (0 hunks)
  • Flow.Launcher/PublicAPIInstance.cs (1 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml.cs (2 hunks)
💤 Files with no reviewable changes (1)
  • Flow.Launcher/MessageBoxEx.xaml.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher/PublicAPIInstance.cs
🧰 Additional context used
🧠 Learnings (1)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (1)
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
🧬 Code Graph Analysis (1)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (3)
Flow.Launcher/PublicAPIInstance.cs (1)
  • MessageBoxResult (454-457)
Plugins/Flow.Launcher.Plugin.Shell/Main.cs (1)
  • ProcessStartInfo (190-301)
Flow.Launcher/SelectBrowserWindow.xaml.cs (1)
  • btnDone_Click (42-47)
🪛 GitHub Check: Check Spelling
Flow.Launcher/SelectFileManagerWindow.xaml.cs

[warning] 146-146:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-136:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-135:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 131-131:
hyperlink is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling
Flow.Launcher/SelectFileManagerWindow.xaml.cs

[warning] 131-32: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 135-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-22: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 146-44: hyperlink is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build

This comment has been minimized.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (2)

117-146: Refactor btnTips_Click to reuse existing Hyperlink_RequestNavigate.

The click-handler in btnTips_Click duplicates the same Process.Start logic found in Hyperlink_RequestNavigate. Extract the hard-coded URL into a resource or constant and wire up the existing Hyperlink_RequestNavigate method instead of inlining the handler.

private async void btnTips_Click(object sender, RoutedEventArgs e)
{
    var tipText = (string)Application.Current.Resources["fileManager_files_tips"];
-   var url = "https://files.community/docs/contributing/updates";
+   // Externalize URL for easier maintenance
+   var url = (string)Application.Current.Resources["fileManager_files_url"] 
+           ?? "https://files.community/docs/contributing/updates";

    var textBlock = new TextBlock
    {
        FontSize = 14,
        TextWrapping = TextWrapping.Wrap,
        Margin = new Thickness(0, 0, 0, 0)
    };
    
    textBlock.Inlines.Add(tipText);
    
    var hyperlink = new Hyperlink
    {
        NavigateUri = new Uri(url)
    };
    hyperlink.Inlines.Add(url);
-   hyperlink.RequestNavigate += (s, args) =>
-   {
-       Process.Start(new ProcessStartInfo
-       {
-           FileName = args.Uri.AbsoluteUri,
-           UseShellExecute = true
-       });
-       args.Handled = true;
-   };
+   // Reuse the existing navigation handler
+   hyperlink.RequestNavigate += Hyperlink_RequestNavigate;

    textBlock.Inlines.Add(hyperlink);
🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 137-137:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-136:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 132-132:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 117-117:
VSTHRD is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 117-174: VSTHRD is not a recognized word. (unrecognized-spelling)


[warning] 132-126: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-122: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 137-122: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 147-144: hyperlink is not a recognized word. (unrecognized-spelling)


49-57: 🛠️ Refactor suggestion

Add exception handling to the URL navigation.

The Hyperlink_RequestNavigate method needs exception handling to prevent crashes in case of invalid URLs or network/permission issues.

private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
+   try
+   {
        Process.Start(new ProcessStartInfo
        {
            FileName = e.Uri.AbsoluteUri,
            UseShellExecute = true
        });
+   }
+   catch (Exception ex)
+   {
+       App.API.ShowMsgBox(
+           string.Format("Failed to open URL: {0}\nError: {1}", e.Uri.AbsoluteUri, ex.Message),
+           "Navigation Error",
+           MessageBoxButton.OK,
+           MessageBoxImage.Error);
+   }
    e.Handled = true;
}
🧹 Nitpick comments (1)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (1)

117-118: Consider explaining the SuppressMessage justification.

The current justification of "" for the VSTHRD100 suppression should be replaced with an actual explanation, such as "Event handler must be async void to use await with ContentDialog".

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 117-117:
VSTHRD is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 117-174: VSTHRD is not a recognized word. (unrecognized-spelling)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3beb4e9 and d23f88d.

📒 Files selected for processing (2)
  • Flow.Launcher/SelectFileManagerWindow.xaml (2 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml.cs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher/SelectFileManagerWindow.xaml
🧰 Additional context used
🧠 Learnings (1)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (1)
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
🪛 GitHub Check: Check Spelling
Flow.Launcher/SelectFileManagerWindow.xaml.cs

[warning] 147-147:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 137-137:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-136:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 132-132:
hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 117-117:
VSTHRD is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling
Flow.Launcher/SelectFileManagerWindow.xaml.cs

[warning] 117-174: VSTHRD is not a recognized word. (unrecognized-spelling)


[warning] 132-126: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 136-122: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 137-122: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 147-144: hyperlink is not a recognized word. (unrecognized-spelling)

🔇 Additional comments (2)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (2)

61-75: LGTM! Good improvement to validate file manager paths.

The validation logic with user-friendly warning messages is a significant improvement that addresses the PR objectives to enhance error handling when configuring file managers.


82-115: Good implementation of path validation with multiple strategies.

The IsFileManagerValid method is well-structured with a comprehensive approach:

  1. Accepts 'explorer' as a valid system command
  2. Verifies existence of full file paths
  3. Uses the 'where' command to check if the command exists in PATH

This covers all common scenarios for file manager configuration.

@Jack251970 Jack251970 requested a review from Copilot May 20, 2025 13:51
@Jack251970 Jack251970 requested a review from jjw24 May 21, 2025 04:59

This comment has been minimized.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
Flow.Launcher/SelectBrowserWindow.xaml.cs (1)

32-43: Consider extracting file dialog path setting logic to a helper method.

The path retrieval logic is complex and appears in multiple places. Consider extracting it to a helper method or moving it to the ViewModel.

This is the same suggestion as made for the SelectFileManagerWindow.xaml.cs file.

🧹 Nitpick comments (1)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (1)

39-50: Consider extracting file dialog path setting logic to a helper method.

The path retrieval logic is complex and appears in multiple places. Consider extracting it to a helper method or moving it to the ViewModel.

 private void btnBrowseFile_Click(object sender, RoutedEventArgs e)
 {
     var dlg = new Microsoft.Win32.OpenFileDialog();
     var result = dlg.ShowDialog();
     if (result == true)
     {
-        var path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox");
+        var path = FindPathTextBox(sender);
         path.Text = dlg.FileName;
         path.Focus();
         ((Button)sender).Focus();
     }
 }
+
+private TextBox FindPathTextBox(object sender)
+{
+    return (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox");
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0f0edb and 6ce2cf9.

📒 Files selected for processing (8)
  • Flow.Launcher/App.xaml.cs (1 hunks)
  • Flow.Launcher/SelectBrowserWindow.xaml (2 hunks)
  • Flow.Launcher/SelectBrowserWindow.xaml.cs (2 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml (3 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml.cs (2 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (1 hunks)
  • Flow.Launcher/ViewModel/SelectBrowserViewModel.cs (1 hunks)
  • Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher/SelectFileManagerWindow.xaml
🧰 Additional context used
🧬 Code Graph Analysis (2)
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (2)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (2)
  • SelectFileManagerWindow (9-51)
  • SelectFileManagerWindow (13-18)
Flow.Launcher/SelectBrowserWindow.xaml.cs (2)
  • SelectBrowserWindow (8-44)
  • SelectBrowserWindow (12-17)
Flow.Launcher/SelectBrowserWindow.xaml.cs (3)
Flow.Launcher/ViewModel/SelectBrowserViewModel.cs (3)
  • SelectBrowserViewModel (9-58)
  • SelectBrowserViewModel (29-34)
  • SaveSettings (36-41)
Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs (1)
  • SaveSettings (47-68)
Flow.Launcher/SelectFileManagerWindow.xaml.cs (1)
  • btnBrowseFile_Click (39-50)
🪛 GitHub Actions: Check Spelling
Flow.Launcher/App.xaml.cs

[warning] 63-63: Spell check warning: WMP is not a recognized word. (unrecognized-spelling)


[warning] 106-106: Spell check warning: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 117-117: Spell check warning: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 119-119: Spell check warning: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 174-174: Spell check warning: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 199-199: Spell check warning: Loadertask is not a recognized word. (unrecognized-spelling)


[warning] 225-225: Spell check warning: VSTHRD is not a recognized word. (unrecognized-spelling)

Flow.Launcher/SelectFileManagerWindow.xaml.cs

[warning] 13-13: Spell check warning: Popu is not a recognized word. (unrecognized-spelling)

Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs

[warning] 120-120: Spell check warning: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 124-124: Spell check warning: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 125-125: Spell check warning: hyperlink is not a recognized word. (unrecognized-spelling)


[warning] 131-131: Spell check warning: hyperlink is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (20)
Flow.Launcher/App.xaml.cs (1)

101-104: Good architectural addition for view model registration

The addition of SelectBrowserViewModel and SelectFileManagerViewModel as transient services is a good pattern. The transient scope is appropriate since these models contain settings that may change, requiring new instances on subsequent requests.

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (2)

338-339: Correctly updated constructor call to match dependency injection changes

This change aligns with the updated SelectFileManagerWindow constructor which now obtains its view model via dependency injection instead of directly accepting a Settings parameter.


345-346: Correctly updated constructor call to match dependency injection changes

This change aligns with the updated SelectBrowserWindow constructor which now obtains its view model via dependency injection instead of directly accepting a Settings parameter.

Flow.Launcher/SelectBrowserWindow.xaml (4)

9-9: Good addition of view model namespace

Adding the view model namespace is necessary for design-time data binding.


12-12: Improved design-time support with DataContext

Setting the design-time data context to the view model enhances the design experience and helps validate bindings.


101-102: Good MVVM pattern implementation for Add button

Changing from event handler to command binding improves separation of concerns and follows MVVM best practices.


105-106: Good MVVM pattern implementation for Delete button

Changing from event handler to command binding improves separation of concerns and follows MVVM best practices.

Flow.Launcher/ViewModel/SelectBrowserViewModel.cs (2)

1-42: Well-structured view model with good separation of concerns

The view model follows MVVM best practices with:

  • Clear property definitions for UI binding
  • Proper initialization of collections from settings
  • Encapsulation of settings management logic
  • Use of observable collections for UI updates

43-52: Clear implementation of Add command

The Add command follows good practices by creating a new instance with a default name and updating the selection index.

Flow.Launcher/SelectFileManagerWindow.xaml.cs (4)

11-11: Appropriate use of the ViewModel pattern.

The code has been updated to use a ViewModel, which is a good practice for separating UI logic from presentation.


13-17: Good use of dependency injection.

The window now uses dependency injection to obtain the ViewModel instead of directly managing settings, which promotes better separation of concerns.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 13-13: Spell check warning: Popu is not a recognized word. (unrecognized-spelling)


25-30: Improved window closing logic.

The window now only closes if settings are successfully saved, which is an improvement over unconditional closing. This ensures that invalid configurations can be addressed before the window closes.


33-37: Better hyperlink navigation.

Using App.API.OpenUrl instead of directly calling Process.Start is a good improvement as it centralizes URL handling logic.

Flow.Launcher/SelectBrowserWindow.xaml.cs (3)

10-10: Good use of the ViewModel pattern.

The code has been updated to use a ViewModel, which is a good practice for separating UI logic from presentation.


12-17: Good use of dependency injection.

The window now uses dependency injection to obtain the ViewModel instead of directly managing settings, which promotes better separation of concerns.


26-29: Improved window closing logic.

The window now only closes if settings are successfully saved, which is an improvement over unconditional closing. This ensures that invalid configurations can be addressed before the window closes.

Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs (4)

17-39: Well-structured ViewModel implementation.

The ViewModel follows proper MVVM patterns with observable collections and property change notifications. The CustomExplorer property correctly retrieves the currently selected item from the collection.


47-68: Good validation in SaveSettings method.

The method properly validates the file manager path before saving and gives users a chance to acknowledge or reject invalid paths with a warning message.


70-103: Comprehensive path validation.

The IsFileManagerValid method handles multiple validation scenarios properly:

  1. Special case for "explorer"
  2. Checking if rooted paths exist
  3. Using "where" command to locate executables in PATH

This is a robust approach to validation.


146-154: Add command implementation looks good.

The Add command correctly adds a new profile and updates the selected index.

This comment has been minimized.

@Jack251970 Jack251970 requested a review from Copilot May 21, 2025 10:38

This comment has been minimized.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Improves handling and feedback when configuring and opening directories with custom file managers by validating paths, updating defaults, and providing clearer error dialogs.

  • Adds validation for custom file manager paths in the settings dialog with user prompts on invalid entries
  • Updates default Files manager path and arguments, and includes a “Learn more” link in the UI
  • Enhances OpenDirectory in the public API with specific exception handling and error messages

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ViewModel/SelectFileManagerViewModel.cs Validates custom file manager paths and prompts on errors
ViewModel/SelectBrowserViewModel.cs Mirror updates for browser settings dialog
SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs Removes constructor args in dialog launches
SelectFileManagerWindow.xaml(.cs) Migrates to MVVM DI, adds hyperlink and separators
SelectBrowserWindow.xaml(.cs) Migrates to MVVM DI
PublicAPIInstance.cs Wraps OpenDirectory in try/catch with tailored messages
MessageBoxEx.xaml.cs Removes deprecated overload
Languages/en.xaml Adds new translation keys for error titles and messages
App.xaml.cs Registers dialog view models as transient
Infrastructure/UserSettings/Settings.cs Changes default Files path and arguments
Comments suppressed due to low confidence (3)

Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs:43

  • Add unit tests for SaveSettings to verify behavior when the custom file manager path is invalid (user Yes/No) and when it is valid.
public bool SaveSettings()

Flow.Launcher/MessageBoxEx.xaml.cs:24

  • The overload Show(string) was removed from MessageBoxEx, which may break existing calls. Ensure all direct calls are updated or consider restoring it.
public static MessageBoxResult Show(string messageBoxText)

Flow.Launcher.Infrastructure/UserSettings/Settings.cs:230

  • The default DirectoryArgument was changed to "%d", removing the -select flag and potentially breaking folder selection for the default Files manager. Restore -select "%d" if intended.
DirectoryArgument = "\"%d\"",

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors and Warnings Count
❌ forbidden-pattern 24
⚠️ non-alpha-in-dictionary 13

See ❌ Event descriptions for more information.

Forbidden patterns 🙅 (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

Pattern

\b[Nn]o[nt][- ]existent\b
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@jjw24 jjw24 requested a review from Copilot May 21, 2025 11:43
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request improves the error handling around file manager configuration by providing more informative messages and updating default settings, while also refactoring several UI dialogs to use dependency injection and command bindings.

  • More informative error messages are now shown when a custom file manager is not found.
  • The default file manager executable path and its arguments have been updated.
  • The file manager and browser selection windows have been refactored to use dependency injection and RelayCommands.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs Added validation and error prompting for invalid file manager paths.
Flow.Launcher/ViewModel/SelectBrowserViewModel.cs Maintains consistency with the file manager view model refactoring.
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs Updated window creation to rely on IoC instead of passing Settings directly.
Flow.Launcher/SelectFileManagerWindow.xaml.cs Removed redundant code; switched to dependency injected view model and command bindings.
Flow.Launcher/SelectFileManagerWindow.xaml Updated DataContext and command bindings for cleaner XAML integration.
Flow.Launcher/SelectBrowserWindow.xaml.cs Similar dependency injection and command binding updates for the browser selector.
Flow.Launcher/SelectBrowserWindow.xaml Updated DataContext and command bindings.
Flow.Launcher/PublicAPIInstance.cs Added try/catch logic for handling file manager launch errors with improved error messages.
Flow.Launcher/MessageBoxEx.xaml.cs Removed unused overload for showing message boxes.
Flow.Launcher/Languages/en.xaml Added new translation keys for enhanced error messages and updated the file manager setting texts.
Flow.Launcher/App.xaml.cs Registered the new view models as transient in the dependency injection container.
Flow.Launcher/Infrastructure/UserSettings/Settings.cs Updated default file manager settings to new executable path and argument format.
Comments suppressed due to low confidence (1)

Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs:77

  • Consider using a using-statement (or a using-declaration) for the Process instance to ensure resources are disposed properly after use.
var process = new Process {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

3 participants