Skip to content

Commit

Permalink
Enhancement: warn on R-II path in OneDrive/non-ascii on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamsyntax committed Dec 11, 2024
1 parent d1d6a59 commit b403d98
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions source/Reloaded.Mod.Launcher.Lib/Static/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,5 @@ public static void Init(IDictionaryResourceProvider provider)
// Update 1.28.6: Problematic Path Warnings
public static IDictionaryResource<string> ProblematicPathTitle { get; set; }
public static IDictionaryResource<string> ProblematicPathAppDescription { get; set; }
public static IDictionaryResource<string> ProblematicPathReloadedDescription { get; set; }
}
15 changes: 14 additions & 1 deletion source/Reloaded.Mod.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,26 @@ private void OnStartup(object sender, StartupEventArgs e)
StartProfileOptimization();
PrepareWebRequests();

// Need to construct MainWindow before invoking any dialog, otherwise Shutdown will be called on closing the dialog
var window = new MainWindow();

// Warn if OneDrive or NonAsciiChars detected in Reloaded-II directory
bool hasNonAsciiChars = AppContext.BaseDirectory.Any(c => c > 127);
if (AppContext.BaseDirectory.Contains("OneDrive") || hasNonAsciiChars)
{
Actions.DisplayMessagebox.Invoke(Lib.Static.Resources.ProblematicPathTitle.Get(), Lib.Static.Resources.ProblematicPathReloadedDescription.Get(), new Actions.DisplayMessageBoxParams()
{
StartupLocation = Actions.WindowStartupLocation.CenterScreen,
Type = Actions.MessageBoxType.Ok
});
}

window.ShowDialog();
}

private void SetupResources()
{
var launcherFolder= AppContext.BaseDirectory;
var launcherFolder = AppContext.BaseDirectory;
var languageSelector = new XamlFileSelector($"{launcherFolder}\\Assets\\Languages");
var themeSelector = new XamlFileSelector($"{launcherFolder}\\Theme");

Expand Down
1 change: 1 addition & 0 deletions source/Reloaded.Mod.Launcher/Assets/Languages/en-GB.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -723,5 +723,6 @@ For more info, refer to the tutorial. Don't forget to set correct Publish target
<!-- Update 1.28.6: Problematic Path Warnings -->
<sys:String x:Key="ProblematicPathTitle">Potentially Problematic Path Detected</sys:String>
<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>
<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>

</ResourceDictionary>

0 comments on commit b403d98

Please # to comment.