Skip to content

Commit af07760

Browse files
committed
Bundle: add SPI for FHS style bundles for testing
The FHS bundles are an extension for the CoreFoundation implementation for Swift. Expose the interface through Bundle interface so that we do not need to use private CF interfaces in the tests.
1 parent 30ca0a3 commit af07760

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Foundation/Bundle.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ import CoreFoundation
1212
open class Bundle: NSObject {
1313
private var _bundle : CFBundle!
1414

15+
public static var _supportsFHSStyle: Bool {
16+
#if DEPLOYMENT_RUNTIME_OBJC
17+
return false
18+
#else
19+
return _CFBundleSupportsFHSBundles()
20+
#endif
21+
}
22+
1523
private static var _mainBundle : Bundle = {
1624
return Bundle(cfBundle: CFBundleGetMainBundle())
1725
}()

TestFoundation/TestBundle.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,8 @@ class BundlePlayground {
4343

4444
static var allApplicable: [Layout] {
4545
let layouts: [Layout] = [ .flat, .fhsInstalled, .fhsFreestanding ]
46-
47-
#if DEPLOYMENT_RUNTIME_OBJC
48-
let supportsFHS = false
49-
#else
50-
let supportsFHS = _CFBundleSupportsFHSBundles()
51-
#endif
52-
53-
if supportsFHS {
46+
47+
if Bundle._supportsFHSStyle {
5448
return layouts
5549
} else {
5650
return layouts.filter { !$0.isFHS }

0 commit comments

Comments
 (0)