Skip to content

Commit

Permalink
makeScriptにFIXModelPackを指定するように
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed May 22, 2020
1 parent 5981f0c commit dbc6f7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fun ModelPackManager.getScriptAndDoScript(fileName: String): ScriptEngine {
usingContext { cx ->
val scope = makeNewScope()

val script = ScriptImporter.makeScript(filePath, scriptStr)
val script = ScriptImporter.makeScript(filePath, scriptStr, resource.pack)

script.exec(cx, scope)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ object ScriptImporter {

fun getScript(name: String): Script {
val resourceLocation = ResourceLocation(name)
val script = FIXFileLoader.getInputStream(resourceLocation).reader().use { it.readText() }
return makeScript(resourceLocation, script)
val resource = FIXFileLoader.getResource(resourceLocation)
val script = resource.inputStream.reader().use { it.readText() }
return makeScript(resourceLocation, script, resource.pack)
}

fun makeScript(location: ResourceLocation, script: String, pack: FIXModelPack? = null): Script {
Expand Down

0 comments on commit dbc6f7c

Please sign in to comment.