[mmp] Implement support for finding the local XamMac prefix when running from Xamarin Studio. (#37)

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).
This commit is contained in:
Rolf Bjarne Kvinge 2016-05-10 20:38:16 +02:00 коммит произвёл Sebastien Pouliot
Родитель eb5a9c0770
Коммит cf4fcbf3c5
2 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -807,12 +807,21 @@ namespace Xamarin.Bundler {
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)));
}

Просмотреть файл

@ -15,7 +15,7 @@
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>MONOMAC;MMP</DefineConstants>
<DefineConstants>MONOMAC;MMP;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>