Replace native drivelist addon with enumeration via winapis + koffi#22909
Replace native drivelist addon with enumeration via winapis + koffi#22909
Conversation
|
It's usually not a good idea to spawn a new process that does some action, are we sure it's an acceptable solution? |
|
This PR has conflicts. You need to rebase the PR before it can be merged. |
|
The code this replaces calls out to wmi, but now that we already have koffi in place we may be able to replace it with calls into the Nt API, I'll look down that path |
|
Done, swapped to koffi, and the implementation remains rather clean. |
6d6a338 to
a3193a2
Compare
|
This PR doesn't have conflicts anymore. It can be merged after all status checks have passed and it has been reviewed. |
drivelist is a native C++ addon that shells out to platform-specific tools to list drives. Replace it with direct PowerShell (Get-CimInstance Win32_LogicalDisk) on Windows and /proc/mounts parsing on Linux. The function is called infrequently (game discovery, staging folder selection) so the PowerShell startup cost is negligible. Resolves APP-403
Use GetLogicalDriveStringsW + GetDriveTypeW from kernel32.dll via koffi instead of spawning powershell.exe. This is instant (no process spawn overhead), consistent with the koffi approach used elsewhere, and calls the same Win32 APIs that the old native drivelist module wrapped.
|
This PR has conflicts. You need to rebase the PR before it can be merged. |
…ist.ts Co-authored-by: erri120 <erri120@erri120.dev>
|
This PR doesn't have conflicts anymore. It can be merged after all status checks have passed and it has been reviewed. |
|
This PR has conflicts. You need to rebase the PR before it can be merged. |
|
This PR doesn't have conflicts anymore. It can be merged after all status checks have passed and it has been reviewed. |
❌ Code is not formattedTo fix this:
Then commit the formatting changes. View logs |
|
This PR has conflicts. You need to rebase the PR before it can be merged. |
Summary
drivelistaddon with pure TS implementationsGetLogicalDriveStringsW+GetDriveTypeWfrom kernel32.dll — the standard Win32 APIs for drive enumeration. Instant (no process spawn), filters toDRIVE_FIXED(type 3)./proc/mountsfiltering for real block devices on common filesystems (ext4, btrfs, xfs, etc.)drivelistfrom bothpackage.jsonfiles,pnpm-workspace.yaml(catalog + allowBuilds),flatpak/generated-sources.json, and the dependency reportgetDriveList()API and error handling behavior are preserved — callers are unchangedResolves APP-403
Test plan
pnpm installsucceeds without drivelist