Skip to content

Commit 03dd9e9

Browse files
authored
Merge pull request #518 from dreamsyntax/rii-path-check
Enhancement: Warn on R-II path in OneDrive/non-ascii on startup
2 parents d1d6a59 + df2bd58 commit 03dd9e9

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

source/Reloaded.Mod.Launcher.Lib/Static/Resources.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,6 @@ public static void Init(IDictionaryResourceProvider provider)
212212
// Update 1.28.6: Problematic Path Warnings
213213
public static IDictionaryResource<string> ProblematicPathTitle { get; set; }
214214
public static IDictionaryResource<string> ProblematicPathAppDescription { get; set; }
215+
public static IDictionaryResource<string> ProblematicPathReloadedDescription { get; set; }
216+
public static IDictionaryResource<string> ProblematicPathModsDescription { get; set; }
215217
}

source/Reloaded.Mod.Launcher/App.xaml.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,43 @@ private void OnStartup(object sender, StartupEventArgs e)
3939
StartProfileOptimization();
4040
PrepareWebRequests();
4141

42+
// Need to construct MainWindow before invoking any dialog, otherwise Shutdown will be called on closing the dialog
4243
var window = new MainWindow();
44+
45+
// Warn if OneDrive or NonAsciiChars detected in Reloaded-II directory
46+
bool reloadedPathHasNonAsciiChars = AppContext.BaseDirectory.Any(c => c > 127);
47+
if (AppContext.BaseDirectory.Contains("OneDrive") || reloadedPathHasNonAsciiChars)
48+
{
49+
Actions.DisplayMessagebox.Invoke(Lib.Static.Resources.ProblematicPathTitle.Get(), Lib.Static.Resources.ProblematicPathReloadedDescription.Get(), new Actions.DisplayMessageBoxParams()
50+
{
51+
StartupLocation = Actions.WindowStartupLocation.CenterScreen,
52+
Type = Actions.MessageBoxType.Ok
53+
});
54+
}
55+
else // We only do this check if the Reloaded-II directory check passed
56+
{
57+
// Warn if OneDrive or NonAsciiChars detected in Mods directory
58+
var modsDirectory = Lib.IoC.Get<LoaderConfig>().GetModConfigDirectory();
59+
if (modsDirectory != null)
60+
{
61+
bool modsDirectoryPathHasNonAsciiChars = modsDirectory.Any(c => c > 127);
62+
if (modsDirectory.Contains("OneDrive") || modsDirectoryPathHasNonAsciiChars)
63+
{
64+
Actions.DisplayMessagebox.Invoke(Lib.Static.Resources.ProblematicPathTitle.Get(), Lib.Static.Resources.ProblematicPathModsDescription.Get(), new Actions.DisplayMessageBoxParams()
65+
{
66+
StartupLocation = Actions.WindowStartupLocation.CenterScreen,
67+
Type = Actions.MessageBoxType.Ok
68+
});
69+
}
70+
}
71+
}
72+
4373
window.ShowDialog();
4474
}
4575

4676
private void SetupResources()
4777
{
48-
var launcherFolder= AppContext.BaseDirectory;
78+
var launcherFolder = AppContext.BaseDirectory;
4979
var languageSelector = new XamlFileSelector($"{launcherFolder}\\Assets\\Languages");
5080
var themeSelector = new XamlFileSelector($"{launcherFolder}\\Theme");
5181

source/Reloaded.Mod.Launcher/Assets/Languages/en-GB.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,5 +723,7 @@ For more info, refer to the tutorial. Don't forget to set correct Publish target
723723
<!-- Update 1.28.6: Problematic Path Warnings -->
724724
<sys:String x:Key="ProblematicPathTitle">Potentially Problematic Path Detected</sys:String>
725725
<sys:String x:Key="ProblematicPathAppDescription">The application you selected is in a folder that is managed by OneDrive or contains non-ASCII (special) characters.&#x0a;It is recommended to move the application to a different path, such as "C:\Games\".&#x0a;Using the application in an unsupported path may result in mods not working.&#x0a;&#x0a;Press OK to add the application anyway.</sys:String>
726+
<sys:String x:Key="ProblematicPathReloadedDescription">Reloaded-II has detected it is installed in a folder that is managed by OneDrive or contains non-ASCII (special) characters.&#x0a;It is recommended to move your Reloaded-II folder to a different path, such as "C:\Reloaded-II\".&#x0a;Keeping Reloaded-II in an unsupported path may result in mods not working.</sys:String>
727+
<sys:String x:Key="ProblematicPathModsDescription">Reloaded-II has detected your mods folder is managed by OneDrive or contains non-ASCII (special) characters.&#x0a;It is recommended to move your mods folder to a different path.&#x0a;Keeping mods in an unsupported path may result in problems running mods.</sys:String>
726728

727729
</ResourceDictionary>

0 commit comments

Comments
 (0)