From 04263803e3633ed36a73f52e7fe376eca7de9677 Mon Sep 17 00:00:00 2001 From: Luke <17146677+LukeFZ@users.noreply.github.com> Date: Fri, 24 May 2024 03:19:46 +0200 Subject: [PATCH] Fix CLI crashing on launch in single file builds --- Il2CppInspector.CLI/Program.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Il2CppInspector.CLI/Program.cs b/Il2CppInspector.CLI/Program.cs index 63fde828..9181b077 100644 --- a/Il2CppInspector.CLI/Program.cs +++ b/Il2CppInspector.CLI/Program.cs @@ -1,4 +1,4 @@ -/* +/* Copyright 2017-2021 Katy Coe - http://www.djkaty.com - https://github.com/djkaty All rights reserved. @@ -9,10 +9,7 @@ All rights reserved. using System.Diagnostics; using System.IO; using System.Linq; -using System.Reflection; -using System.Reflection.Emit; using System.Runtime.InteropServices; -using System.Xml.Schema; using CommandLine; using CommandLine.Text; using Il2CppInspector.Cpp; @@ -20,6 +17,7 @@ All rights reserved. using Il2CppInspector.Model; using Il2CppInspector.Outputs; using Il2CppInspector.Reflection; +using Assembly = System.Reflection.Assembly; namespace Il2CppInspector.CLI { @@ -176,7 +174,11 @@ private static int DisplayHelp(ParserResult result, IEnumerable private static int Run(Options options) { // Banner - var asmInfo = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetEntryAssembly().Location); + var location = Assembly.GetEntryAssembly().Location; + if (location == "") // Single file executables don't have an assembly location + location = Path.Join(AppContext.BaseDirectory, "Il2CppInspector.exe"); + + var asmInfo = FileVersionInfo.GetVersionInfo(location); Console.WriteLine(asmInfo.ProductName); Console.WriteLine("Version " + asmInfo.ProductVersion); Console.WriteLine(asmInfo.LegalCopyright);