summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/script_instance.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/script/script_instance.cpp b/src/script/script_instance.cpp
index 81283cb77..836bb8246 100644
--- a/src/script/script_instance.cpp
+++ b/src/script/script_instance.cpp
@@ -116,17 +116,16 @@ bool ScriptInstance::LoadCompatibilityScripts(const char *api_version, Subdirect
{
char script_name[32];
seprintf(script_name, lastof(script_name), "compat_%s.nut", api_version);
- char buf[MAX_PATH];
Searchpath sp;
FOR_ALL_SEARCHPATHS(sp) {
- FioAppendDirectory(buf, lastof(buf), sp, dir);
- strecat(buf, script_name, lastof(buf));
- if (!FileExists(buf)) continue;
+ std::string buf = FioGetDirectory(sp, dir);
+ buf += script_name;
+ if (!FileExists(buf.c_str())) continue;
- if (this->engine->LoadScript(buf)) return true;
+ if (this->engine->LoadScript(buf.c_str())) return true;
ScriptLog::Error("Failed to load API compatibility script");
- DEBUG(script, 0, "Error compiling / running API compatibility script: %s", buf);
+ DEBUG(script, 0, "Error compiling / running API compatibility script: %s", buf.c_str());
return false;
}