1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-08 13:11:54 +00:00
TegraExplorer/source/fs/fsutils.c
SuchMemeManySkill 1a931b0256 Add errors
and prepare for file menu more
and fix that you can't go left right when going up down
2020-12-25 00:20:30 +01:00

45 lines
No EOL
885 B
C

#include <mem/heap.h>
#include <string.h>
#include "fsutils.h"
#include "../utils/utils.h"
#include <utils/sprintf.h>
#include <libs/fatfs/ff.h>
#include "readers/folderReader.h"
char *CombinePaths(const char *current, const char *add){
char *ret;
size_t size = strlen(current) + strlen(add) + 2;
ret = (char*) malloc (size);
sprintf(ret, (current[strlen(current) - 1] == '/') ? "%s%s" : "%s/%s", current, add);
return ret;
}
char *EscapeFolder(char *current){
char *ret;
char *temp;
ret = CpyStr(current);
temp = strrchr(ret, '/');
if (*(temp - 1) == ':')
temp++;
*temp = '\0';
return ret;
}
u64 GetFileSize(char *path){
FILINFO fno;
f_stat(path, &fno);
return fno.fsize;
}
char *GetFileAttribs(FSEntry_t entry){
char *ret = CpyStr("RHSVDA");
MaskIn(ret, entry.optionUnion, '-');
return ret;
}