Skip to content

Commit 26f4f23

Browse files
committed
Normalize bundle resource URLs for Android Foundation
1 parent 33308e9 commit 26f4f23

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Sources/BluetoothExplorerPluginEngine/PluginLoader.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ public enum PluginLoader {
7676

7777
/// Scan a bundle's `Plugins/` directory for `*.bleplugin.json` manifests and load each.
7878
public static func loadBundled(from bundle: Bundle) -> (loaded: [LoadedPlugin], failures: [PluginLoadFailure]) {
79-
let manifestURLs = bundle.urls(forResourcesWithExtension: "json", subdirectory: "Plugins") ?? []
79+
// `urls(forResourcesWithExtension:subdirectory:)` yields `[URL]` on Darwin but `[NSURL]` on
80+
// Android's Foundation, so normalize before touching path components.
81+
let discovered = bundle.urls(forResourcesWithExtension: "json", subdirectory: "Plugins") ?? []
82+
let manifestURLs: [URL] = discovered.map { $0 as URL }
8083
var loaded = [LoadedPlugin]()
8184
var failures = [PluginLoadFailure]()
8285
for url in manifestURLs where url.lastPathComponent.hasSuffix(".bleplugin.json") {

0 commit comments

Comments
 (0)