Skip to content

Fall back to JS realpath on Windows WinFsp drives - #111

Merged
mberman84 merged 2 commits into
mainfrom
fix/winfsp-realpath-open
Nov 27, 2026
Merged

mberman84 merged 2 commits into
mainfrom
fix/winfsp-realpath-open

Conversation

@mberman84

Copy link
Copy Markdown
Collaborator

Problem

On Windows, double-clicking a PDF (or opening a Word document) stored on an rclone / WinFsp drive mounted in default mode fails with Couldn't open file because Node's native fs.promises.realpath fails with UNKNOWN on those virtual drives (#98).

Change

  • Added resolvePath in electron/document-files.cjs that calls fs.promises.realpath and, only when process.platform === "win32" and the error code is UNKNOWN, falls back to Node's async JS fs.realpath implementation (promisify(fs.realpath)).
  • Used resolvePath in both sendFile (electron/main.cjs) and stageWord (electron/document-files.cjs), keeping all existing checkDiskPath and withRegular (lstat / open / handle.stat identity) guards intact.
  • Added unit tests in scripts/test-word-files.cjs verifying the fallback triggers only for Windows UNKNOWN errors and rethrows all other errors and platforms unchanged.

Issue or approval

Closes #98.

How I checked it

  • Verified on macOS (darwin): node --test scripts/test-word-files.cjs passes including the new resolvePath fallback and error-handling tests.
  • Windows, macOS, and Linux test suites run in GitHub Actions CI. Could not test on a live rclone / WinFsp mount locally (verified via simulated UNKNOWN error and Node's real JS fs.realpath fallback).

Implemented with Gemini 4 Neon in T3 Code.

@mberman84
mberman84 merged commit d05f1f6 into main Nov 27, 2026
5 of 6 checks passed
@mberman84
mberman84 deleted the fix/winfsp-realpath-open branch November 27, 2026 23:52
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.

Windows: double-click open fails on rclone/WinFsp drives (realpath UNKNOWN error)

1 participant