fix(macos): prioritize main bundle for device resources to prevent crash
This commit is contained in:
committed by
Peter Steinberger
parent
5e280674f9
commit
ad475239a5
@@ -122,12 +122,13 @@ enum DeviceModelCatalog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static func locateResourceBundle() -> Bundle? {
|
private static func locateResourceBundle() -> Bundle? {
|
||||||
// Prefer module bundle (SwiftPM/tests), then main app bundle (packaged app).
|
// Prefer main bundle (packaged app), then module bundle (SwiftPM/tests).
|
||||||
if let bundle = self.bundleIfContainsDeviceModels(Bundle.module) {
|
// Accessing Bundle.module in the packaged app can crash if the bundle isn't where SwiftPM expects it.
|
||||||
|
if let bundle = self.bundleIfContainsDeviceModels(Bundle.main) {
|
||||||
return bundle
|
return bundle
|
||||||
}
|
}
|
||||||
|
|
||||||
if let bundle = self.bundleIfContainsDeviceModels(Bundle.main) {
|
if let bundle = self.bundleIfContainsDeviceModels(Bundle.module) {
|
||||||
return bundle
|
return bundle
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user