From 075ba266d03ab5b66dbce8a93886d226310c5939 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 10 May 2016 18:16:19 +0200 Subject: [PATCH] [mmp] Implement support for finding the local XamMac prefix when running from Xamarin Studio. Traverse directories to find the locally build XamMac directory when DEBUG is defined (which is only defined in the csproj, which is only built when running from Xamarin Studio, since the mmp we ship is built manually in the Makefile). --- tools/mmp/driver.cs | 13 +++++++++++-- tools/mmp/mmp.csproj | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/mmp/driver.cs b/tools/mmp/driver.cs index 25d4b7106c14..9342d76afaba 100644 --- a/tools/mmp/driver.cs +++ b/tools/mmp/driver.cs @@ -807,12 +807,21 @@ static string GetRealPath (string path) static string GetXamMacPrefix () { - var path = System.Reflection.Assembly.GetExecutingAssembly ().Location; - var envFrameworkPath = Environment.GetEnvironmentVariable ("XAMMAC_FRAMEWORK_PATH"); if (!String.IsNullOrEmpty (envFrameworkPath) && Directory.Exists (envFrameworkPath)) return envFrameworkPath; + var path = System.Reflection.Assembly.GetExecutingAssembly ().Location; + +#if DEBUG + var localPath = Path.GetDirectoryName (path); + while (localPath.Length > 1) { + if (Directory.Exists (Path.Combine (localPath, "_mac-build"))) + return Path.Combine (localPath, "_mac-build", "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); + localPath = Path.GetDirectoryName (localPath); + } +#endif + path = GetRealPath (path); return Path.GetDirectoryName (Path.GetDirectoryName (Path.GetDirectoryName (path))); } diff --git a/tools/mmp/mmp.csproj b/tools/mmp/mmp.csproj index 42d45ea72440..600c5c7324c4 100644 --- a/tools/mmp/mmp.csproj +++ b/tools/mmp/mmp.csproj @@ -15,7 +15,7 @@ full False bin\Debug - MONOMAC;MMP + MONOMAC;MMP;DEBUG prompt 4 AnyCPU