Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Warn on R-II path in OneDrive/non-ascii on startup #518

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 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,6 @@ 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; }
public static IDictionaryResource<string> ProblematicPathModsDescription { get; set; }
}
32 changes: 31 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,43 @@ 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 reloadedPathHasNonAsciiChars = AppContext.BaseDirectory.Any(c => c > 127);
if (AppContext.BaseDirectory.Contains("OneDrive") || reloadedPathHasNonAsciiChars)
{
Actions.DisplayMessagebox.Invoke(Lib.Static.Resources.ProblematicPathTitle.Get(), Lib.Static.Resources.ProblematicPathReloadedDescription.Get(), new Actions.DisplayMessageBoxParams()
{
StartupLocation = Actions.WindowStartupLocation.CenterScreen,
Type = Actions.MessageBoxType.Ok
});
}
else // We only do this check if the Reloaded-II directory check passed
{
// Warn if OneDrive or NonAsciiChars detected in Mods directory
var modsDirectory = Lib.IoC.Get<LoaderConfig>().GetModConfigDirectory();
if (modsDirectory != null)
{
bool modsDirectoryPathHasNonAsciiChars = modsDirectory.Any(c => c > 127);
if (modsDirectory.Contains("OneDrive") || modsDirectoryPathHasNonAsciiChars)
{
Actions.DisplayMessagebox.Invoke(Lib.Static.Resources.ProblematicPathTitle.Get(), Lib.Static.Resources.ProblematicPathModsDescription.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
2 changes: 2 additions & 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,7 @@ 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>
<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>

</ResourceDictionary>
Loading