Skip to content

Fix Windows libmpv search paths - #20

Draft
Blackspirits wants to merge 3 commits into
upl/review-base-18eefrom
fix/windows-libmpv-search-path-18ee
Draft

Fix Windows libmpv search paths#20
Blackspirits wants to merge 3 commits into
upl/review-base-18eefrom
fix/windows-libmpv-search-path-18ee

Conversation

@Blackspirits

Copy link
Copy Markdown
Owner

Summary

On Windows the libmpv loader currently searches the manual override, current working directory, and the default loader path. The installer stores libmpv under the per-user data folder, so lookup should not depend on the process working directory.

This change makes the Windows order explicit:

  1. manual override
  2. Subtitle Edit data folder
  3. application base directory
  4. current working directory
  5. default loader path

It also de-duplicates equivalent roots and adds focused regression coverage.

Validation

  • focused LibMpv tests passed
  • full solution test suite passed
  • validation run: #34524488270

AI assistance: ChatGPT was used to audit Windows library discovery and prepare the regression-tested fix.

@Blackspirits
Blackspirits requested a lite review from Copilot September 11, 2026 00:28

Copilot AI commented Sep 11, 2026

Copy link
Copy Markdown

@Blackspirits Thanks for sending me some feedback. Unfortunately, I hit an error while trying to use the custom Copilot setup steps configured for this repository. The error I am seeing is:

no supported setup-steps job found in your workflow file. Please ensure you have a job named copilot-code-review or copilot-setup-steps. For more details, see https://gh.io/copilot/actions-setup-steps

Once you or someone with the necessary access fixes the problem, please let me know in a comment and I'll try again. Thanks!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Normalize equivalent Windows directory paths to prevent duplicate probing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes Windows libmpv discovery by prioritizing user data and application directories, with regression coverage.

Changes:

  • Defines ordered Windows search paths with fallback handling.
  • Adds path de-duplication.
  • Adds focused ordering and de-duplication tests.
File summaries
File Summary
tests/UI/Logic/VideoPlayers/LibMpvLibraryPathTests.cs Tests search ordering and de-duplication.
src/ui/Logic/VideoPlayers/LibMpvDynamic/LibMpvDynamicPlayer.cs Implements Windows search paths; equivalent roots are not fully normalized before comparison.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ui/Logic/VideoPlayers/LibMpvDynamic/LibMpvDynamicPlayer.cs Outdated
@Blackspirits
Blackspirits requested a lite review from Copilot September 11, 2026 00:31

Copilot AI commented Sep 11, 2026

Copy link
Copy Markdown

@Blackspirits Thanks for sending me some feedback. Unfortunately, I hit an error while trying to use the custom Copilot setup steps configured for this repository. The error I am seeing is:

no supported setup-steps job found in your workflow file. Please ensure you have a job named copilot-code-review or copilot-setup-steps. For more details, see https://gh.io/copilot/actions-setup-steps

Once you or someone with the necessary access fixes the problem, please let me know in a comment and I'll try again. Thanks!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The default loader-path fallback and Windows root de-duplication still need correction.

Review details

Suppressed comments (2)

src/ui/Logic/VideoPlayers/LibMpvDynamic/LibMpvDynamicPlayer.cs:394

  • Adding string.Empty here does not make the default Windows loader path reachable: LoadLibraryInternal first requires File.Exists(fullPath), and for this entry fullPath is just libmpv-2.dll, which File.Exists checks only in the current directory rather than PATH/system loader directories. A DLL available only through the Windows loader search path will therefore still be skipped; handle the empty-root candidate without that precheck (or resolve the loader path explicitly).
        }

src/ui/Logic/VideoPlayers/LibMpvDynamic/LibMpvDynamicPlayer.cs:379

  • This compares raw strings, so it does not actually de-duplicate equivalent Windows roots such as C:\app vs C:\app\ (or slash variants). AppContext.BaseDirectory commonly has a trailing separator while Directory.GetCurrentDirectory() does not, so a portable run can probe the same directory twice; normalize non-empty roots before comparing while keeping string.Empty as the distinct default-loader entry.
        {
            if (string.IsNullOrEmpty(path))
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@Blackspirits
Blackspirits requested a lite review from Copilot September 11, 2026 00:37

Copilot AI commented Sep 11, 2026

Copy link
Copy Markdown

@Blackspirits Thanks for sending me some feedback. Unfortunately, I hit an error while trying to use the custom Copilot setup steps configured for this repository. The error I am seeing is:

no supported setup-steps job found in your workflow file. Please ensure you have a job named copilot-code-review or copilot-setup-steps. For more details, see https://gh.io/copilot/actions-setup-steps

Once you or someone with the necessary access fixes the problem, please let me know in a comment and I'll try again. Thanks!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved review issues; focused and full test suites passed.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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.

3 participants