diff --git a/source/tegraexplorer/script/functions.c b/source/tegraexplorer/script/functions.c index 4cc42fb..0efd63a 100644 --- a/source/tegraexplorer/script/functions.c +++ b/source/tegraexplorer/script/functions.c @@ -446,6 +446,22 @@ int part_stringcompare(){ return (strcmp(left, right)) ? 0 : 1; } +int part_fs_combinePath(){ + char *combined, *left, *middle; + if (parseStringInput(argv[0], &left)) + return -1; + if (parseStringInput(argv[1], &middle)) + return -1; + if (argv[2][0] != '$') + return -1; + + combined = fsutil_getnextloc(left, middle); + + str_str_add(argv[2], combined); + free(combined); + return 0; +} + str_fnc_struct functions[] = { {"printf", part_printf, 1}, {"printInt", part_print_int, 1}, @@ -471,6 +487,7 @@ str_fnc_struct functions[] = { {"fs_openDir", part_fs_OpenDir, 1}, {"fs_closeDir", part_fs_CloseDir, 0}, {"fs_readDir", part_fs_ReadDir, 0}, + {"fs_combinePath", part_fs_combinePath, 3}, {"mmc_connect", part_ConnectMMC, 1}, {"mmc_mount", part_MountMMC, 1}, {"pause", part_Pause, 0}, diff --git a/source/tegraexplorer/script/parser.c b/source/tegraexplorer/script/parser.c index 9c764d9..13ffb64 100644 --- a/source/tegraexplorer/script/parser.c +++ b/source/tegraexplorer/script/parser.c @@ -15,7 +15,7 @@ #include "functions.h" #include "variables.h" #include "../fs/fsreader.h" - +#include "../utils/utils.h" u32 countchars(char* in, char target) { u32 len = strlen(in); @@ -267,10 +267,12 @@ extern u32 currentcolor; extern char *currentpath; void runScript(char *path){ int res; + char *path_local = NULL; forceExit = false; currentchar = 0; currentcolor = COLOR_WHITE; gfx_clearscreen(); + utils_copystring(path, &path_local); res = f_open(&scriptin, path, FA_READ | FA_OPEN_EXISTING); if (res != FR_OK){ @@ -301,5 +303,6 @@ void runScript(char *path){ str_int_clear(); str_jmp_clear(); str_str_clear(); + free(path_local); //btn_wait(); } \ No newline at end of file