Skip to content

Commit

Permalink
Merge pull request #43 from mxcl/Bundle.executable
Browse files Browse the repository at this point in the history
Add Bundle.executable
  • Loading branch information
repo-ranger[bot] authored Feb 17, 2019
2 parents dc7affa + f4c2c75 commit e915bc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
1 change: 1 addition & 0 deletions Tests/PathTests/PathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e915bc0

Please sign in to comment.