diff --git a/source/Reloaded.Mod.Launcher.Lib/Update.cs b/source/Reloaded.Mod.Launcher.Lib/Update.cs index 9c2fdb0d..b0b8d8db 100644 --- a/source/Reloaded.Mod.Launcher.Lib/Update.cs +++ b/source/Reloaded.Mod.Launcher.Lib/Update.cs @@ -165,7 +165,6 @@ public static async Task ResolveMissingPackagesAsync(CancellationToken token = d ModDependencyResolveResult? lastResolveResult = default; ModDependencyResolveResult resolveResult; - var isOneDrive = IsOneDrive(); do { resolveResult = await GetMissingDependenciesToDownload(token); @@ -180,9 +179,6 @@ public static async Task ResolveMissingPackagesAsync(CancellationToken token = d lastResolveResult = resolveResult; DownloadPackages(resolveResult, token); - - // Very terrible hack, caused by a FileSystem bug on MSFT's end somewhere. - if (isOneDrive) await Task.Delay(1000, token); } while (true); @@ -200,7 +196,6 @@ public static void ResolveMissingPackages() ModDependencyResolveResult? lastResolveResult = default; ModDependencyResolveResult resolveResult; - var isOneDrive = IsOneDrive(); do { @@ -215,10 +210,7 @@ public static void ResolveMissingPackages() } DownloadPackages(resolveResult); - lastResolveResult = resolveResult; - - // Very terrible hack, caused by a FileSystem bug on MSFT's end somewhere. - if (isOneDrive) Thread.Sleep(1000); + lastResolveResult = resolveResult; } while (true); @@ -335,18 +327,6 @@ public static bool CheckForInternetConnection() return false; } - - /// - /// On Windows 11, Microsoft defaults some accounts to sync via OneDrive. - /// Unfortunately their implementation has issues, files that were downloaded can't immediately be seen by FileSystem. - /// - /// We 'hack' around this (poorly), but our solution is far from ideal. - /// - private static bool IsOneDrive() - { - var conf = IoC.Get(); - return conf.GetModConfigDirectory().Contains("OneDrive", StringComparison.OrdinalIgnoreCase); - } // TODO: This is a temporary hack to get people unstuck. private static bool IsSameAsLast(ModDependencyResolveResult thisItem, ModDependencyResolveResult? lastItem) diff --git a/source/Reloaded.Mod.Loader.IO/Services/ConfigServiceBase.cs b/source/Reloaded.Mod.Loader.IO/Services/ConfigServiceBase.cs index 87ecf682..109e534f 100644 --- a/source/Reloaded.Mod.Loader.IO/Services/ConfigServiceBase.cs +++ b/source/Reloaded.Mod.Loader.IO/Services/ConfigServiceBase.cs @@ -75,6 +75,15 @@ public void MoveFolder(string newDirectory) { throw new NotImplementedException("This feature will be implemented in the future."); } + + /// + /// Populates the mod list governed by . + /// + protected void ForceRefresh() + { + bool executeImmediately = _context == null; + GetItems(executeImmediately); + } /// /// Populates the mod list governed by . diff --git a/source/Reloaded.Mod.Loader.IO/Services/ModConfigService.cs b/source/Reloaded.Mod.Loader.IO/Services/ModConfigService.cs index ca263b9f..c8146fec 100644 --- a/source/Reloaded.Mod.Loader.IO/Services/ModConfigService.cs +++ b/source/Reloaded.Mod.Loader.IO/Services/ModConfigService.cs @@ -34,6 +34,11 @@ public ModConfigService(LoaderConfig config, SynchronizationContext context = nu /// public DependencyResolutionResult GetMissingDependencies(IEnumerable modsToResolve) { + // Force a refresh of all mods. + // On some FileSystems, you can't get reliable notifications on FS changes. + // This includes OneDrive, which is now enabled by default on Windows 11 installs (unfortunately). + ForceRefresh(); + // Get list of all mods. var allMods = Items.ToArray(); var allModIds = new HashSet(allMods.Length);