summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-12-06 21:11:44 +0100
committerMichael Lutz <michi@icosahedron.de>2020-12-27 13:19:25 +0100
commitf3326d34e78bd28fba6d8cfd3bc455a506b429fe (patch)
tree307a0608a7fb1c211fd72a8b8326cfe9bb1d37a2 /src/script
parent0c6e8a8123c9f74db757272f73adcbd8621e012d (diff)
downloadopenttd-f3326d34e78bd28fba6d8cfd3bc455a506b429fe.tar.xz
Codechange: Use std::string in FIO search path handling.
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;
}