Add Bundle.executable
This commit is contained in:
@@ -34,6 +34,11 @@ public extension Bundle {
|
||||
var path: Path {
|
||||
return Path(string: bundlePath)
|
||||
}
|
||||
|
||||
/// Returns the executable for this bundle, if there is one, not all bundles have one hence `Optional`.
|
||||
var executable: Path? {
|
||||
return executablePath.flatMap(Path.init)
|
||||
}
|
||||
}
|
||||
|
||||
/// Extensions on `String` that work with `Path` rather than `String` or `URL`
|
||||
|
||||
@@ -403,6 +403,7 @@ class PathTests: XCTestCase {
|
||||
XCTAssertEqual(bndl.privateFrameworks, tmpdir.Frameworks)
|
||||
XCTAssertEqual(bndl.resources, tmpdir)
|
||||
XCTAssertNil(bndl.path(forResource: "foo", ofType: "bar"))
|
||||
XCTAssertNil(bndl.executable)
|
||||
|
||||
#if os(macOS)
|
||||
XCTAssertEqual(bndl.defaultSharedFrameworksPath, tmpdir.Contents.Frameworks)
|
||||
|
||||
Reference in New Issue
Block a user