Fixed: Directory scanner skipping OneDrive cloud folders#883
Conversation
- WindowsDirectorySearcher now only skips name-surrogate reparse points (symlinks/junctions). OneDrive cloud folders use a different reparse tag and are no longer incorrectly skipped during directory enumeration, which caused mod/user configs inside them to go undetected. - Detect OneDrive paths via environment variables instead of substring matching, fixing false positives/negatives in installer and launcher.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughThis PR adds cloud-sync path detection, uses it in installer and launcher path checks, and refines directory enumeration to skip only name-surrogate reparse-point directories. ChangesCloud-Sync Path Detection System
Reparse Point Filtering Refinement
🎯 4 (Complex) | ⏱️ ~45 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@source/Reloaded.Mod.Installer.Lib/Settings.cs`:
- Around line 61-74: The installer’s IsPathInCloudSyncFolder currently only
checks IsInOneDrive and IsInRegisteredCloudSyncRoot, causing mismatch with the
launcher's third-tier known-folder fallback; update IsPathInCloudSyncFolder to
include the same third-tier check used by the launcher (for example by calling
the launcher's known-folder fallback method, e.g.
IsInKnownFolderCloudFilesFallback(path) or the shared utility that launcher
uses) so the return becomes IsInOneDrive(fullPath) ||
IsInRegisteredCloudSyncRoot(fullPath) ||
IsInKnownFolderCloudFilesFallback(fullPath); ensure you reference and reuse the
existing launcher/shared fallback implementation rather than duplicating logic.
In `@source/Reloaded.Mod.Loader.IO/Utility/Windows/WindowsDirectorySearcher.cs`:
- Around line 243-244: The IsNameSurrogateReparsePoint helper currently uses the
wrong bitmask: change the REPARSE_TAG_NAME_SURROGATE constant in
WindowsDirectorySearcher.cs from 0x80000000 to 0x20000000 (the Microsoft
"name-surrogate" / bit 29 mask) and keep the existing check (*(uint*)buffer &
REPARSE_TAG_NAME_SURROGATE) != 0 so name-surrogate reparse points are detected
correctly and cloud reparse tags are not misclassified.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d59e8d5c-f159-48c3-a285-769297153162
📒 Files selected for processing (5)
source/Reloaded.Mod.Installer.Lib/Settings.cssource/Reloaded.Mod.Launcher.Lib/Commands/Application/AddApplicationCommand.cssource/Reloaded.Mod.Launcher.Lib/Utility/PathUtility.cssource/Reloaded.Mod.Launcher/App.xaml.cssource/Reloaded.Mod.Loader.IO/Utility/Windows/WindowsDirectorySearcher.cs
- Replace OneDrive-only substring/env-var checks with layered detection (OneDrive env vars, Cloud Files API via CfGetSyncRootInfoByPath, known cloud folder names) so Dropbox, Google Drive, iCloud, etc. are caught. - cldapi missing on older than Windows 10 1709 falls back gracefully. - Installer keeps two tiers (Desktop is only redirected by OneDrive).
09b92a5 to
ba760d1
Compare
|
Would you be able to test this? 2 things to test; take a backup of your Reloaded folder first just in case: Installerhttps://github.com/Reloaded-Project/Reloaded-II/actions/runs/27480906195/artifacts/7615083550 LauncherIs the fix logic still working? If you use this built version (just extract anywhere), does stuff work? I don't have a Windows virtual machine ready; so it may be easier to just ask. |
|
I must clarify, though, that the 'installation' in OneDrive was a manual sync (error) on my part, not an automatic sync. Unless |
|
Update for The original fix logic still works. I extracted the zip into a backup I had of Reloaded-II (not from the new installer). I don't know if the new launcher was supposed to change anything... but, yes. New stuff still works. |
|
@Opst34 Thanks 👏 When you run the installer, it does a check, and tries to prevent itself from installing into Cloud Storage; i.e. OneDrive. I was curious if it avoided |
|
Noted. Good luck coding the files to completely avoid OneDrive, if it's even possible. Though, to be honest, one can avoid this issue by simply not being a dumbass like me who accidentally started sync. They wouldn't be in OneDrive otherwise. |
Summary
Two bugs fixed around cloud sync folders:
Directory enumeration skipped cloud folders.
WindowsDirectorySearcherdropped any entry with theReparsePointattribute unless it also hadOffline. Some cloud folders (unfortunately) carry a different reparse tag withoutOffline. This caused mods/configs inside them to go undetected.Cloud detection used substring matching.
path.Contains("OneDrive")was a poor hack that only covered OneDrive and broke on non-default roots or any folder literally namedOneDrive. We now detect any cloud sync provider via OneDrive env vars + the Windows Cloud Files API (CfGetSyncRootInfoByPath) + known folder names as fallback.