Skip to content

Commit

Permalink
[Xamarin.MacDev] Add a few convenience overloads to IAppleSdk. (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne authored Apr 18, 2023
1 parent 920e87e commit bab25f5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Xamarin.MacDev/AppleSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ public string GetSdkPath (string version, bool sim)
return Path.Combine (DevicePlatform, "Developer/SDKs/" + DevicePlatformName + version + ".sdk");
}

public string GetSdkPath (bool isSimulator)
{
return GetSdkPath (string.Empty, isSimulator);
}

public string GetSdkPath ()
{
throw new InvalidOperationException ($"This AppleSdk requires specifying whether we're targeting the simulator or not, so please use the other overload taking a 'bool isSimulator' parameter.");
}

public string GetSdkPath (string version)
{
throw new InvalidOperationException ($"This AppleSdk requires specifying whether we're targeting the simulator or not, so please use the other overload taking a 'bool isSimulator' parameter.");
}

string GetSdkPlistFilename (string version, bool sim)
{
return Path.Combine (GetSdkPath (version, sim), "SDKSettings.plist");
Expand Down
3 changes: 3 additions & 0 deletions Xamarin.MacDev/IAppleSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ public interface IAppleSdk {
string DeveloperRoot { get; }
string GetPlatformPath (bool isSimulator);
string GetSdkPath (string version, bool isSimulator);
string GetSdkPath (bool isSimulator);
string GetSdkPath (string version);
string GetSdkPath ();
bool SdkIsInstalled (IAppleSdkVersion version, bool isSimulator);
bool TryParseSdkVersion (string value, out IAppleSdkVersion version);
IAppleSdkVersion GetClosestInstalledSdk (IAppleSdkVersion version, bool isSimulator);
Expand Down
10 changes: 10 additions & 0 deletions Xamarin.MacDev/MacOSXSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ string IAppleSdk.GetSdkPath (string version, bool isSimulator)
return GetSdkPath (version);
}

public string GetSdkPath (bool isSimulator)
{
return GetSdkPath (string.Empty);
}

public string GetSdkPath ()
{
return GetSdkPath (string.Empty);
}

string GetSdkPlistFilename (string version)
{
return Path.Combine (GetSdkPath (version), "SDKSettings.plist");
Expand Down

0 comments on commit bab25f5

Please sign in to comment.