mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 17:51:13 +02:00
Added a command line option (-c, --config) to load a configuration file through the command line parameters
This commit is contained in:
committed by
KeatonTheBot
parent
0380173937
commit
49b0927fd5
@@ -1,5 +1,6 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Ryujinx.UI.Common.Helper
|
||||
{
|
||||
@@ -16,6 +17,7 @@ namespace Ryujinx.UI.Common.Helper
|
||||
public static string LaunchPathArg { get; private set; }
|
||||
public static string LaunchApplicationId { get; private set; }
|
||||
public static bool StartFullscreenArg { get; private set; }
|
||||
public static string OverrideConfigFile { get; private set; }
|
||||
public static bool HideAvailableUpdates { get; private set; }
|
||||
|
||||
public static void ParseArguments(string[] args)
|
||||
@@ -100,6 +102,29 @@ namespace Ryujinx.UI.Common.Helper
|
||||
case "--software-gui":
|
||||
OverrideHardwareAcceleration = false;
|
||||
break;
|
||||
case "-c":
|
||||
case "--config":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
string configFile = args[++i];
|
||||
|
||||
if (Path.GetExtension(configFile).ToLower() != ".json")
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
OverrideConfigFile = configFile;
|
||||
|
||||
arguments.Add(arg);
|
||||
arguments.Add(args[i]);
|
||||
break;
|
||||
default:
|
||||
LaunchPathArg = arg;
|
||||
break;
|
||||
|
||||
@@ -151,6 +151,11 @@ namespace Ryujinx.Ava
|
||||
ConfigurationPath = appDataConfigurationPath;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(CommandLineState.OverrideConfigFile) && File.Exists(CommandLineState.OverrideConfigFile))
|
||||
{
|
||||
ConfigurationPath = CommandLineState.OverrideConfigFile;
|
||||
}
|
||||
|
||||
if (ConfigurationPath == null)
|
||||
{
|
||||
// No configuration, we load the default values and save it to disk
|
||||
|
||||
Reference in New Issue
Block a user