diff --git a/source/states/ScriptedState.hx b/source/states/ScriptedState.hx index a9881b3..e3ea9f7 100644 --- a/source/states/ScriptedState.hx +++ b/source/states/ScriptedState.hx @@ -26,8 +26,12 @@ class ScriptedState extends ExtendableState { #end for (folder in folders) { - if (FileSystem.exists(Paths.script(folder + path))) { - path = Paths.script(folder + path); + if (FileSystem.exists(folder)) { + for (file in FileSystem.readDirectory(folder)) { + if (file.startsWith(path) && file.endsWith('.hxs')) { + path = folder + file; + } + } } } diff --git a/source/substates/ScriptedSubState.hx b/source/substates/ScriptedSubState.hx index aa26fc2..7f31467 100644 --- a/source/substates/ScriptedSubState.hx +++ b/source/substates/ScriptedSubState.hx @@ -20,8 +20,12 @@ class ScriptedSubState extends ExtendableSubState { #end for (folder in folders) { - if (FileSystem.exists(Paths.script(folder + path))) { - path = Paths.script(folder + path); + if (FileSystem.exists(folder)) { + for (file in FileSystem.readDirectory(folder)) { + if (file.startsWith(path) && file.endsWith('.hxs')) { + path = folder + file; + } + } } }