Skip to content

Commit 6783779

Browse files
[Android][CoreCLR] Use relative path instead of just the filename when probing for assembly (#118054)
* Use the relative path to the assembly instead of just its name * Enable newly fixed tests * Rename argument name to relative_assembly_path
1 parent e1d6402 commit 6783779

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/libraries/tests.proj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@
229229
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.Http\tests\FunctionalTests\System.Net.Http.Functional.Tests.csproj" />
230230
<!-- https://github.com/dotnet/runtime/issues/114951 -->
231231
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Diagnostics.DiagnosticSource\tests\TestWithConfigSwitches\System.Diagnostics.DiagnosticSource.Switches.Tests.csproj" />
232-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime\tests\System.Resources.ResourceManager.Tests\System.Resources.ResourceManager.Tests.csproj" />
233232
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime\tests\System.Runtime.Tests\InvariantTimezone\System.Runtime.InvariantTimezone.Tests.csproj" />
234233
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime\tests\System.Text.Encoding.Tests\System.Text.Encoding.Tests.csproj" />
235234
<!-- https://github.com/dotnet/runtime/issues/62547 -->

src/tasks/AndroidAppBuilder/Templates/monodroid-coreclr.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,18 @@ bundle_executable_path (const char* executable, const char* bundle_path, const c
9898
}
9999

100100
static bool
101-
external_assembly_probe(const char* name, void** data, int64_t* size)
101+
external_assembly_probe(const char* relative_assembly_path, void** data, int64_t* size)
102102
{
103103
if (g_mapped_files_count >= MAX_MAPPED_COUNT)
104104
{
105-
LOG_ERROR("Too many mapped files, cannot map %s", name);
105+
LOG_ERROR("Too many mapped files, cannot map %s", relative_assembly_path);
106106
return false;
107107
}
108108

109-
// Get just the file name
110-
const char* pos = strrchr(name, '/');
111-
if (pos != NULL)
112-
name = pos + 1;
113-
114109
// Look in the bundle path where the files were extracted
115110
char full_path[1024];
116-
size_t path_len = strlen(g_bundle_path) + strlen(name) + 1; // +1 for '/'
117-
size_t res = snprintf(full_path, path_len + 1, "%s/%s", g_bundle_path, name);
111+
size_t path_len = strlen(g_bundle_path) + strlen(relative_assembly_path) + 1; // +1 for '/'
112+
size_t res = snprintf(full_path, path_len + 1, "%s/%s", g_bundle_path, relative_assembly_path);
118113
if (res < 0 || res != path_len)
119114
return false;
120115

@@ -137,7 +132,7 @@ external_assembly_probe(const char* name, void** data, int64_t* size)
137132
return false;
138133
}
139134

140-
LOG_INFO("Mapped %s -> %s", name, full_path);
135+
LOG_INFO("Mapped %s -> %s", relative_assembly_path, full_path);
141136
g_mapped_files[g_mapped_files_count] = mapped;
142137
g_mapped_file_sizes[g_mapped_files_count] = size_local;
143138
g_mapped_files_count++;

0 commit comments

Comments
 (0)