Add method to display contents of file in WebViewWindowController.
This commit is contained in:
parent
773f660601
commit
5d781d1657
@ -24,4 +24,14 @@ public final class WebViewWindowController: NSWindowController {
|
|||||||
|
|
||||||
window!.title = title
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user