Skip to content

WIP: Fix drag-and-drop on Windows#1074

Draft
rly wants to merge 1 commit intomainfrom
fix/windows-drag-and-drop
Draft

WIP: Fix drag-and-drop on Windows#1074
rly wants to merge 1 commit intomainfrom
fix/windows-drag-and-drop

Conversation

@rly
Copy link
Copy Markdown
Collaborator

@rly rly commented Mar 8, 2026

Summary

Fixes #180

Problem

Drag-and-drop from Windows Explorer into NWB GUIDE does not work on Windows. This is caused by "requestedExecutionLevel": "requireAdministrator" in the electron-builder config (package.json), which forces the app to always run as Administrator. Windows enforces User Interface Privilege Isolation (UIPI), which blocks drag-and-drop from lower-privilege processes (like Explorer) into higher-privilege processes (the elevated Electron app). macOS has no equivalent restriction, which is why this only affects Windows.

This was identified as the root cause in electron/electron#12460.

Solution

  1. Change requestedExecutionLevel from "requireAdministrator" to "asInvoker" so the app runs at the same privilege level as Explorer, allowing drag-and-drop to work.

  2. Replace direct os.symlink calls with a create_link helper that gracefully handles the loss of guaranteed admin privileges. The app uses symlinks in two places:

    • Creating a directory symlink from the default conversion output path to a custom output directory (convert_to_nwb)
    • Creating file symlinks to aggregate NWB files into a temp directory for DANDI upload (_aggregate_symlinks_in_new_directory)

    On Windows, symlinks require either Administrator privileges or Developer Mode. Since we no longer guarantee admin, create_link uses the following fallback chain:

    • Try os.symlink — works if the user has Developer Mode enabled or is running as admin
    • Fall back to directory junctions (_winapi.CreateJunction) for directories — these never require admin
    • Fall back to hard links (os.link) for files — these don't require admin but require source and destination to be on the same drive
    • Raise a clear error if all options fail, advising the user to either run NWB GUIDE as Administrator or ensure files are on the same drive

    On non-Windows platforms, behavior is unchanged (always uses os.symlink).

Test plan

  • Test drag-and-drop on Windows without running as Administrator
  • Test conversion with a custom output directory on Windows
  • Test DANDI upload of multiple filesystem objects on Windows
  • Test that click-to-choose file selection still works
  • Verify no regressions on macOS

🤖 Generated with Claude Code

Change requestedExecutionLevel from requireAdministrator to asInvoker
so that Windows UIPI does not block drag-and-drop from Explorer into
the app. Replace direct symlink calls with a create_link helper that
falls back to directory junctions and hard links when symlinks are
unavailable without admin privileges.

Fixes #180

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

[Bug] Dragger for drag-and-drop is no longer working

1 participant