Browse Source

Slight improvement to error reporting

pull/62/head
Anairkoen Schno 3 years ago
parent
commit
1449e46c6a
Signed by: DaNike GPG Key ID: BEFB74D5F3FC4387
2 changed files with 17 additions and 4 deletions
  1. +7
    -4
      IPA/Program.cs
  2. +10
    -0
      IPA/_Attributes.cs

+ 7
- 4
IPA/Program.cs View File

@ -95,10 +95,13 @@ namespace IPA
AppDomain.CurrentDomain.AssemblyResolve += AssemblyLibLoader;
var argExeName = Arguments.CmdLine.PositionalArgs.FirstOrDefault(s => s.EndsWith(".exe"));
argExeName ??= new DirectoryInfo(Directory.GetCurrentDirectory()).GetFiles()
.FirstOrDefault(o => o.Extension == ".exe" && o.FullName != Assembly.GetEntryAssembly().Location)
?.FullName;
if (argExeName == null)
context = PatchContext.Create(new DirectoryInfo(Directory.GetCurrentDirectory()).GetFiles()
.First(o => o.Extension == ".exe" && o.FullName != Assembly.GetEntryAssembly().Location)
.FullName);
{
Fail("Could not locate game executable");
}
else
context = PatchContext.Create(argExeName);
@ -341,7 +344,7 @@ namespace IPA
}
}
[DoesNotReturn]
private static void Fail(string message)
{
Console.Error.WriteLine("ERROR: " + message);


+ 10
- 0
IPA/_Attributes.cs View File

@ -0,0 +1,10 @@
#if NET461
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class DoesNotReturnAttribute : Attribute
{
public DoesNotReturnAttribute() { }
}
}
#endif

Loading…
Cancel
Save