mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add method to display contents of file in WebViewWindowController.
This commit is contained in:
@@ -24,4 +24,14 @@ public final class WebViewWindowController: NSWindowController {
|
||||
|
||||
window!.title = title
|
||||
}
|
||||
|
||||
public func displayContents(of path: String) {
|
||||
|
||||
// We assume there might be images, style sheets, etc. contained by the folder that the file appears in, so we get read access to the parent folder.
|
||||
|
||||
let fileURL = URL(fileURLWithPath: path)
|
||||
let folderURL = fileURL.deletingLastPathComponent()
|
||||
|
||||
webview.loadFileURL(fileURL, allowingReadAccessTo: folderURL)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user