chg: some more checks in pathing

This commit is contained in:
iceman1001 2019-08-22 17:44:08 +02:00
commit ab38130c3e
2 changed files with 21 additions and 16 deletions

View file

@ -142,9 +142,11 @@ static int CmdScriptRun(const char *Cmd) {
bool found = false;
int error;
if (get_my_executable_directory() != NULL) {
char script_path[strlen(get_my_executable_directory()) + strlen(LUA_SCRIPTS_DIRECTORY) + strlen(script_name) + strlen(suffix) + 1];
strcpy(script_path, get_my_executable_directory());
const char* exec_path = get_my_executable_directory();
if (exec_path != NULL) {
char script_path[strlen(exec_path) + strlen(LUA_SCRIPTS_DIRECTORY) + strlen(script_name) + strlen(suffix) + 1];
strcpy(script_path, exec_path);
strcat(script_path, LUA_SCRIPTS_DIRECTORY);
strcat(script_path, script_name);
strcat(script_path, suffix);