Skip to content

Code Quality: Switch Win32 compat mode off on Linux (P4-Z) - #74

Merged
MemerGamer merged 2 commits into
linux/mainfrom
linux/p4-z
Oct 5, 2026
Merged

MemerGamer merged 2 commits into
linux/mainfrom
linux/p4-z

Conversation

@MemerGamer

Copy link
Copy Markdown
Owner

Resolved / Related Issues

Phase 4 work package P4-Z (docs/linux-port/PLAN.md, Phase 4 plan Revision 3). No issue.

Stacked on #73 (P4-E). P4-E wasn't merged when this started, so this branch is based on linux/p4-e. Merge #73 first; this PR's own change is the last commit (889d848).

What changed

  • Directory.Build.props: FilesWin32Compat now defaults to false. -p:FilesWin32Compat=true remains as an opt-in inventory lens and now also defines FILES_WIN32_COMPAT, so files that only build in compat mode (Utils/Shell, Services/Windows) still compile.
  • Errors per build iteration, compat off: 2 → 53 → 2 → 0. After IStorageItemWithPath.Item became Windows-only, one more round: 2 → 10 → 0.
  • Moved to *.Windows.cs unchanged: CloudDrivesDetector, GenericCloudDetector, OXDriveCloudDetector (registry and exe icons) and MtpHelpers (Shell COM; its only caller is already under #if WINDOWS).
  • Small #if WINDOWS blocks with Linux fallbacks:
    • Recycle Bin empty uses Task.Run instead of STATask.
    • Library display name, library attributes and SeerPro are Windows-only.
    • BringToForegroundEx, the ShellItem/ShellDataObject drag payload (Linux uses DesktopFileDragHelper) and GetDoubleClickTime (Linux uses 500 ms) are guarded.
    • Format drive from the network widget goes through DriveHelpers.OpenFormatDialogAsync.
  • ShellHelpers.cs (portable) is compiled again on desktop.
  • New stubs in DesktopStubServices.cs:
    • DesktopCommonDialogService (LINUX-TODO(pickers): xdg-desktop-portal FileChooser). Pickers report cancelled, as the Win32 version effectively did on Linux.
    • DesktopStartMenuService: no pins.
  • Removed:
    • IStorageItemWithPath.Item and its explicit implementations are now #if WINDOWS. Drag-out-of-archive checks use a new IsArchiveMember() extension (Windows: the original ZipStorage* test; Linux: ArchiveFolder/ArchiveEntryFile or IsZipPath).
    • Unused desktop WinRT StorageHelpers members are deleted: ToStorageItem(IStorageItemWithPath), ToStorageItemResult, GetFileSize, ToType.
  • New stubs (LINUX-TODO):
    • storage-sense: Open Storage Sense does nothing.
    • launch: commands typed into the address bar are reported as an invalid path.
  • ci-linux.yml: the Files.App desktop build passes -p:FilesWin32Compat=false and is blocking. A new step fails if Files.App.CsWin32 was built. Locally, after deleting its bin/obj, the default build left both absent, and the project graph has no CsWin32 reference.
  • The compat-off baseline is now 0 keys. PLAN.md marks Phase 4 done (and Phase 2's criterion met). phase2-errors.md is marked resolved/historical.

Steps used to test these changes

  1. dotnet build src/Files.App -f net10.0-desktop (compat off by default): 0 errors.
  2. -p:FilesWin32Compat=true: 0 errors.
  3. Platform tests: 864 passed, 7 skipped, 0 failed.
  4. Headless smoke test on the compat-off build (headless-run.sh, showcase drives and seed). Each step passed: browse; copy into Reports; move into Notes; trash; restore from the Recycle Bin; browse into Projects.zip and its Projects folder; live exec touch/rm; search; Properties. The files on disk were checked afterwards.
  5. The Windows target can't be built on this machine, so the #if WINDOWS branches and *.Windows.cs files haven't been compiled.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LeKXJc3DnK3PzAqwgA72NY

MemerGamer and others added 2 commits October 5, 2026 22:51
Move the FindFirstFileEx/StorageFolder enumeration, ReadDirectoryChangesW
watchers, alternate data streams, Recycle Bin shell items and BitLocker
prompt verbatim into ShellViewModel.Windows.cs. Linux lists archive roots
and folders through IStorableResolver/ArchiveFolder (read-only, no
watcher) and can navigate into folders inside an archive. Ratchet the
compat-off baseline to 2 keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeKXJc3DnK3PzAqwgA72NY
FilesWin32Compat now defaults to false and stays as an opt-in lens
(defines FILES_WIN32_COMPAT). The desktop build compiles with 0 errors
and without the CsWin32 prebuild: registry cloud detectors and MTP shell
resolution move to *.Windows.cs, the remaining Win32 call sites get small
#if WINDOWS blocks or Linux fallbacks, ICommonDialogService and
IStartMenuService get desktop stubs, and IStorageItemWithPath.Item plus
the unused desktop WinRT StorageHelpers members are gone. Linux CI builds
Files.App with compat off as a blocking step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeKXJc3DnK3PzAqwgA72NY
@MemerGamer
MemerGamer merged commit df9f844 into linux/main Oct 5, 2026
4 of 5 checks passed
@MemerGamer
MemerGamer deleted the linux/p4-z branch October 5, 2026 20:29
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.

1 participant