Bundle.privateFrameworks

This commit is contained in:
Max Howell
2019-02-09 13:24:57 -05:00
parent ed45d10179
commit 8469565b06
2 changed files with 13 additions and 1 deletions

View File

@@ -9,11 +9,22 @@ public extension Bundle {
return str.flatMap(Path.init)
}
/// Returns the path for the shared-frameworks directory in this bundle.
/**
Returns the path for the shared-frameworks directory in this bundle.
- Note: This is typically `ShareFrameworks`
*/
var sharedFrameworks: Path {
return sharedFrameworksPath.flatMap(Path.init) ?? defaultSharedFrameworksPath
}
/**
Returns the path for the private-frameworks directory in this bundle.
- Note: This is typically `Frameworks`
*/
var privateFrameworks: Path {
return privateFrameworksPath.flatMap(Path.init) ?? defaultSharedFrameworksPath
}
/// Returns the path for the resources directory in this bundle.
var resources: Path {
return resourcePath.flatMap(Path.init) ?? defaultResourcesPath

View File

@@ -361,6 +361,7 @@ class PathTests: XCTestCase {
let bndl = Bundle(path: tmpdir.string)!
XCTAssertEqual(bndl.path, tmpdir)
XCTAssertEqual(bndl.sharedFrameworks, tmpdir.SharedFrameworks)
XCTAssertEqual(bndl.privateFrameworks, tmpdir.Frameworks)
XCTAssertEqual(bndl.resources, tmpdir)
XCTAssertNil(bndl.path(forResource: "foo", ofType: "bar"))