Fix sandboxing issues with default browser setting.

This commit is contained in:
Brent Simmons committed 2026-05-23 10:12:30 -07:00
1 parent 18c9102101
commit e1111168f0
1 file changed
+6 -11
@@ -146,13 +146,9 @@ import UniformTypeIdentifiers
return _bundleIdentifier
}
private lazy var _bundlePath: String? = {
return Bundle(url: url)?.bundlePath
}()
/// The bundle path of the web browser
public var bundlePath: String? {
return _bundlePath
/// The bundle path of the web browser.
public var bundlePath: String {
url.path
}
/// Initializes a `MacWebBrowser` with a URL on disk.
@@ -173,13 +169,12 @@ import UniformTypeIdentifiers
/// Initializes a `MacWebBrowser` from a path.
/// - Parameter path: Path to the app, as in `/Applications/Firefox.app`.
/// - Returns: `nil` if no app exists at `path`.
/// - Returns: `nil` if nothing exists at `path`.
public convenience init?(path: String) {
let url = URL(fileURLWithPath: path)
guard Bundle(url: url) != nil else {
guard FileManager.default.fileExists(atPath: path) else {
return nil
}
self.init(url: url)
self.init(url: URL(fileURLWithPath: path))
}
/// Opens a URL in this browser.