Skip to content

Commit

Permalink
better
Browse files Browse the repository at this point in the history
  • Loading branch information
grendello committed Oct 23, 2024
1 parent c1b144f commit 046c3d2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,17 +468,17 @@ bool ShouldIgnoreSplitConfigs ()

void GetRequiredTokens (string assemblyFilePath, out int android_runtime_jnienv_class_token, out int jnienv_initialize_method_token, out int jnienv_registerjninatives_method_token)
{
if (File.Exists (assemblyFilePath)) {
using var pe = new PEReader (File.OpenRead (assemblyFilePath));
GetRequiredTokens (pe.GetMetadataReader (), out android_runtime_jnienv_class_token, out jnienv_initialize_method_token, out jnienv_registerjninatives_method_token);
} else {
if (!File.Exists (assemblyFilePath)) {
android_runtime_jnienv_class_token = -1;
jnienv_initialize_method_token = -1;
jnienv_registerjninatives_method_token = -1;
Log.LogDebugMessage ($"Assembly '{assemblyFilePath}' does not exist, unable to read required tokens from it");
return;
}

using var pe = new PEReader (File.OpenRead (assemblyFilePath));
GetRequiredTokens (pe.GetMetadataReader (), out android_runtime_jnienv_class_token, out jnienv_initialize_method_token, out jnienv_registerjninatives_method_token);

if (android_runtime_jnienv_class_token == -1 || jnienv_initialize_method_token == -1 || jnienv_registerjninatives_method_token == -1) {
throw new InvalidOperationException ($"Unable to find the required Android.Runtime.JNIEnvInit method tokens for {assemblyFilePath}");
}
Expand Down

0 comments on commit 046c3d2

Please sign in to comment.