Skip to content

Commit

Permalink
Fix build task error if android sdk does not exists #37
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Romanov committed Feb 15, 2023
1 parent 34beed9 commit 62c1ba7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/DotNet.Meteor.Debug/CLI/ConsoleUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void AllDevices(string[] args) {
}

public static void AndroidSdkPath(string[] args) {
string path = Android.PathUtils.SdkLocation();
string path = Android.PathUtils.SdkLocation(logger.Error);
Console.WriteLine(JsonSerializer.Serialize(path));
}

Expand Down
5 changes: 3 additions & 2 deletions src/DotNet.Meteor.Shared/Android/PathUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace DotNet.Meteor.Android {
public static class PathUtils {
public static string SdkLocation() {
public static string SdkLocation(Action<string> errorHandler = null) {
string path = Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT");

if (!string.IsNullOrEmpty(path) && Directory.Exists(path))
Expand All @@ -30,7 +30,8 @@ public static string SdkLocation() {
if (Directory.Exists(path))
return path;

throw new Exception("Could not find Android SDK path");
errorHandler?.Invoke("Could not find Android SDK path");
return string.Empty;
}

public static string AvdLocation() {
Expand Down

0 comments on commit 62c1ba7

Please sign in to comment.