Skip to content

Commit 9855aa3

Browse files
committed
Print banner only on windows
TLDR: GetVersionInfo works only with PE Header Reference: https://stackoverflow.com/questions/63773485/c-sharp-fileversioninfo-getversioninfo-not-working-on-mac-os
1 parent 87766f6 commit 9855aa3

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

Il2CppInspector.CLI/Program.cs

+12-11
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,18 @@ private static int DisplayHelp(ParserResult<Options> result, IEnumerable<Error>
172172
}
173173

174174
private static int Run(Options options) {
175-
176-
// Banner
177-
var location = Assembly.GetEntryAssembly().Location;
178-
if (location == "") // Single file executables don't have an assembly location
179-
location = Path.Join(AppContext.BaseDirectory, "Il2CppInspector.exe");
180-
181-
var asmInfo = FileVersionInfo.GetVersionInfo(location);
182-
Console.WriteLine(asmInfo.ProductName);
183-
Console.WriteLine("Version " + asmInfo.ProductVersion);
184-
Console.WriteLine(asmInfo.LegalCopyright);
185-
Console.WriteLine("");
175+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
176+
// Banner
177+
var location = Assembly.GetEntryAssembly().Location;
178+
if (location == "") // Single file executables don't have an assembly location
179+
location = Path.Join(AppContext.BaseDirectory, "Il2CppInspector.exe");
180+
181+
var asmInfo = FileVersionInfo.GetVersionInfo(location);
182+
Console.WriteLine(asmInfo.ProductName);
183+
Console.WriteLine("Version " + asmInfo.ProductVersion);
184+
Console.WriteLine(asmInfo.LegalCopyright);
185+
Console.WriteLine("");
186+
}
186187

187188
// Safe plugin manager load
188189
try {

0 commit comments

Comments
 (0)