forked from xamarin/GoogleApisForiOSComponents
-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathExtension.cs
More file actions
33 lines (29 loc) · 1.05 KB
/
Copy pathExtension.cs
File metadata and controls
33 lines (29 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Runtime.InteropServices;
using ObjCRuntime;
namespace Firebase.CloudFunctions {
public partial class CloudFunctions {
static string? currentVersion;
public static string CurrentVersion {
get {
if (currentVersion == null) {
IntPtr RTLD_MAIN_ONLY = Dlfcn.dlopen (null, 0);
if (RTLD_MAIN_ONLY == IntPtr.Zero)
throw new InvalidOperationException ("Unable to open the main program handle.");
try {
IntPtr ptr = Dlfcn.dlsym (RTLD_MAIN_ONLY, "FirebaseFunctionsVersionString");
if (ptr == IntPtr.Zero)
throw new InvalidOperationException ("Unable to resolve FirebaseFunctionsVersionString.");
currentVersion = Marshal.PtrToStringAnsi (ptr)
?? throw new InvalidOperationException ("Unable to read FirebaseFunctionsVersionString.");
} finally {
Dlfcn.dlclose (RTLD_MAIN_ONLY);
}
}
return currentVersion;
}
}
public const string CloudFunctionsErrorDomain = "com.firebase.functions";
public const string CloudFunctionsErrorDetailsKey = "details";
}
}