mirror of
https://github.com/StikDebug/StikJIT.git
synced 2026-10-15 20:10:31 +00:00
Support for legacy script (#1)
This commit is contained in:
parent
5bdecfcafa
commit
2320badda8
8 changed files with 128 additions and 13 deletions
|
|
@ -2,9 +2,9 @@ import Foundation
|
|||
|
||||
enum BundledScript {
|
||||
|
||||
static func universalJS() throws -> String {
|
||||
static func source(for script: StikJIT.Script) throws -> String {
|
||||
let bundle = Bundle(for: BundleToken.self)
|
||||
guard let url = bundle.url(forResource: "universal", withExtension: "js"),
|
||||
guard let url = bundle.url(forResource: script.resourceName, withExtension: "js"),
|
||||
let source = try? String(contentsOf: url, encoding: .utf8),
|
||||
!source.isEmpty else {
|
||||
throw StikJITError.scriptUnavailable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue