mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Allow multiple instances of osu! when running under debug
This commit is contained in:
parent
849629708b
commit
292bd22f92
@ -29,29 +29,36 @@ namespace osu.Desktop
|
||||
|
||||
if (!host.IsPrimaryInstance)
|
||||
{
|
||||
var importer = new ArchiveImportIPCChannel(host);
|
||||
// Restore the cwd so relative paths given at the command line work correctly
|
||||
Directory.SetCurrentDirectory(cwd);
|
||||
|
||||
foreach (var file in args)
|
||||
if (args.Length > 0 && args[0].Contains('.')) // easy way to check for a file import in args
|
||||
{
|
||||
Console.WriteLine(@"Importing {0}", file);
|
||||
if (!importer.ImportAsync(Path.GetFullPath(file)).Wait(3000))
|
||||
throw new TimeoutException(@"IPC took too long to send");
|
||||
var importer = new ArchiveImportIPCChannel(host);
|
||||
// Restore the cwd so relative paths given at the command line work correctly
|
||||
Directory.SetCurrentDirectory(cwd);
|
||||
|
||||
foreach (var file in args)
|
||||
{
|
||||
Console.WriteLine(@"Importing {0}", file);
|
||||
if (!importer.ImportAsync(Path.GetFullPath(file)).Wait(3000))
|
||||
throw new TimeoutException(@"IPC took too long to send");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// we want to allow multiple instances to be started when in debug.
|
||||
if (!DebugUtils.IsDebugBuild)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (args.FirstOrDefault() ?? string.Empty)
|
||||
{
|
||||
default:
|
||||
host.Run(new OsuGameDesktop(args));
|
||||
break;
|
||||
|
||||
case "--tournament":
|
||||
host.Run(new TournamentGame());
|
||||
break;
|
||||
}
|
||||
switch (args.FirstOrDefault() ?? string.Empty)
|
||||
{
|
||||
default:
|
||||
host.Run(new OsuGameDesktop(args));
|
||||
break;
|
||||
|
||||
case "--tournament":
|
||||
host.Run(new TournamentGame());
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -20,6 +20,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input;
|
||||
@ -153,7 +154,7 @@ namespace osu.Game
|
||||
{
|
||||
this.frameworkConfig = frameworkConfig;
|
||||
|
||||
if (!Host.IsPrimaryInstance)
|
||||
if (!Host.IsPrimaryInstance && !DebugUtils.IsDebugBuild)
|
||||
{
|
||||
Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
|
||||
Environment.Exit(0);
|
||||
|
Loading…
Reference in New Issue
Block a user