Change --config behavior to allow for multi instance

This commit is contained in:
Natsumi
2024-02-14 14:19:10 +13:00
parent e2e907da77
commit b7d5255f3b
3 changed files with 33 additions and 14 deletions

View File

@@ -6,6 +6,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Text;
using System.Windows.Forms;
@@ -31,14 +32,22 @@ namespace VRCX
LaunchCommand = arg.Substring(12);
if (arg.Length > 8 && arg.Substring(0, 8) == "--config")
Program.ConfigLocation = arg.Substring(9);
{
var filePath = arg.Substring(9);
if (File.Exists(filePath))
{
MessageBox.Show("Move your \"VRCX.sqlite3\" into a folder then specify the folder in the launch parameter e.g.\n--config=\"C:\\VRCX\\\"", "--config is now a directory", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(0);
}
Program.AppDataDirectory = filePath;
}
if ((arg.Length >= 7 && arg.Substring(0, 7) == "--debug") || isDebug)
Program.LaunchDebug = true;
}
if (processList.Length > 1 && !string.IsNullOrEmpty(LaunchCommand))
return; // if we're launching with a parameter, allow it
if (!string.IsNullOrEmpty(Program.AppDataDirectory))
return; // we're launching with a custom config path, allow it
// if we're launching a second instance, focus the first instance then exit
if (processList.Length > 1)