1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-23 04:12:04 +00:00

Add fs_combinePath()

This commit is contained in:
Such Meme, Many Skill 2020-04-03 19:07:42 +02:00
parent 744f90611a
commit 8832b240a4
2 changed files with 21 additions and 1 deletions

View file

@ -446,6 +446,22 @@ int part_stringcompare(){
return (strcmp(left, right)) ? 0 : 1; 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[] = { str_fnc_struct functions[] = {
{"printf", part_printf, 1}, {"printf", part_printf, 1},
{"printInt", part_print_int, 1}, {"printInt", part_print_int, 1},
@ -471,6 +487,7 @@ str_fnc_struct functions[] = {
{"fs_openDir", part_fs_OpenDir, 1}, {"fs_openDir", part_fs_OpenDir, 1},
{"fs_closeDir", part_fs_CloseDir, 0}, {"fs_closeDir", part_fs_CloseDir, 0},
{"fs_readDir", part_fs_ReadDir, 0}, {"fs_readDir", part_fs_ReadDir, 0},
{"fs_combinePath", part_fs_combinePath, 3},
{"mmc_connect", part_ConnectMMC, 1}, {"mmc_connect", part_ConnectMMC, 1},
{"mmc_mount", part_MountMMC, 1}, {"mmc_mount", part_MountMMC, 1},
{"pause", part_Pause, 0}, {"pause", part_Pause, 0},

View file

@ -15,7 +15,7 @@
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
#include "../fs/fsreader.h" #include "../fs/fsreader.h"
#include "../utils/utils.h"
u32 countchars(char* in, char target) { u32 countchars(char* in, char target) {
u32 len = strlen(in); u32 len = strlen(in);
@ -267,10 +267,12 @@ extern u32 currentcolor;
extern char *currentpath; extern char *currentpath;
void runScript(char *path){ void runScript(char *path){
int res; int res;
char *path_local = NULL;
forceExit = false; forceExit = false;
currentchar = 0; currentchar = 0;
currentcolor = COLOR_WHITE; currentcolor = COLOR_WHITE;
gfx_clearscreen(); gfx_clearscreen();
utils_copystring(path, &path_local);
res = f_open(&scriptin, path, FA_READ | FA_OPEN_EXISTING); res = f_open(&scriptin, path, FA_READ | FA_OPEN_EXISTING);
if (res != FR_OK){ if (res != FR_OK){
@ -301,5 +303,6 @@ void runScript(char *path){
str_int_clear(); str_int_clear();
str_jmp_clear(); str_jmp_clear();
str_str_clear(); str_str_clear();
free(path_local);
//btn_wait(); //btn_wait();
} }