From fbb177fafecf51acfa3a67a0b62dce74c42a4567 Mon Sep 17 00:00:00 2001 From: vivalavladislav Date: Thu, 9 Jul 2020 22:12:22 +0300 Subject: [PATCH] Fix project generation on OS X (#48) * Fixes to folder reference for osx * Add platform dependent suffix checks * Push path fixes Co-authored-by: Vlad Sviatetskyi --- Il2CppInspector.CLI/Program.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Il2CppInspector.CLI/Program.cs b/Il2CppInspector.CLI/Program.cs index e454c73..83fcc8b 100644 --- a/Il2CppInspector.CLI/Program.cs +++ b/Il2CppInspector.CLI/Program.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using CommandLine; using Il2CppInspector.Cpp; using Il2CppInspector.Cpp.UnityHeaders; @@ -115,7 +116,7 @@ namespace Il2CppInspector.CLI Console.WriteLine("Version " + asmInfo.ProductVersion); Console.WriteLine(asmInfo.LegalCopyright); Console.WriteLine(""); - + // Check excluded namespaces if (options.ExcludedNamespaces.Count() == 1 && options.ExcludedNamespaces.First().ToLower() == "none") options.ExcludedNamespaces = new List(); @@ -132,16 +133,24 @@ namespace Il2CppInspector.CLI Console.Error.WriteLine($"Unity path {unityPath} does not exist"); return 1; } - if (!File.Exists(unityPath + @"\Editor\Data\Managed\UnityEditor.dll")) { + + string editorPathSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) + ? @"/Contents/Managed/UnityEditor.dll" + : @"\Editor\Data\Managed\UnityEditor.dll"; + + if (!File.Exists(unityPath + editorPathSuffix)) { Console.Error.WriteLine($"No Unity installation found at {unityPath}"); return 1; } + if (!Directory.Exists(unityAssembliesPath)) { Console.Error.WriteLine($"Unity assemblies path {unityAssembliesPath} does not exist"); return 1; } - if (!File.Exists(unityAssembliesPath + @"\UnityEngine.UI.dll")) { - Console.Error.WriteLine($"No Unity assemblies found at {unityAssembliesPath}"); + + string uiDllPath = Path.Combine(unityAssembliesPath, "UnityEngine.UI.dll"); + if (!File.Exists(uiDllPath)) { + Console.Error.WriteLine($"No UnityEngine.UI.dll assemblies found at {uiDllPath}"); return 1; }