mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-18 09:19:17 +01:00
*Moved gct.cpp and gct.h to branches since its not used and seems somehow to cause troubles (it shouldnt be but somehow it does -_-)
*Changed subfoldercreation function
This commit is contained in:
parent
ca3ab2f042
commit
00d8692ebe
File diff suppressed because one or more lines are too long
@ -35,6 +35,30 @@ while ((file = readdir(dir)))
|
||||
return false;
|
||||
}
|
||||
|
||||
bool subfoldercreate(char * fullpath) {
|
||||
//check forsubfolders
|
||||
char dircheck[300];
|
||||
char dirnoslash[300];
|
||||
char * pch = NULL;
|
||||
u32 cnt = 0;
|
||||
struct stat st;
|
||||
|
||||
snprintf(dirnoslash, strlen(fullpath), "%s", fullpath);
|
||||
|
||||
if(stat(fullpath, &st) != 0) {
|
||||
pch = strrchr(dirnoslash, '/');
|
||||
cnt = pch-dirnoslash;
|
||||
snprintf(dircheck, cnt+2, "%s", dirnoslash);
|
||||
subfoldercreate(dircheck);
|
||||
};
|
||||
|
||||
if (mkdir(dirnoslash, 0777) == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
char * GetFileName(int i)
|
||||
{
|
||||
return alldirfiles[i];
|
||||
@ -49,11 +73,11 @@ s32 filenamescmp(const void *a, const void *b)
|
||||
int GetAllDirFiles(char * filespath)
|
||||
{
|
||||
int countfiles = 0;
|
||||
|
||||
|
||||
struct stat st;
|
||||
DIR_ITER* dir;
|
||||
dir = diropen (filespath);
|
||||
|
||||
|
||||
if (dir == NULL) //If empty
|
||||
return 0;
|
||||
while (dirnext(dir,filenames,&st) == 0)
|
||||
|
@ -9,7 +9,7 @@ extern "C"
|
||||
bool findfile(const char * filename, const char * path);
|
||||
char * GetFileName(int i);
|
||||
int GetAllDirFiles(char * filespath);
|
||||
|
||||
bool subfoldercreate(char * fullpath);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ main(int argc, char *argv[])
|
||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||
|
||||
fontSystem = new FreeTypeGX();
|
||||
char *fontPath=0;
|
||||
char *fontPath = NULL;
|
||||
asprintf(&fontPath, "%sfont.ttf", CFG.theme_path);
|
||||
fontSystem->loadFont(fontPath, font_ttf, font_ttf_size, 0);
|
||||
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
||||
|
@ -1988,23 +1988,15 @@ ProgressDownloadWindow(int choice2)
|
||||
//check if directory exist and if not create one
|
||||
struct stat st;
|
||||
if(stat(Settings.covers_path, &st) != 0) {
|
||||
char dircovers[100];
|
||||
snprintf(dircovers,strlen(Settings.covers_path),"%s",Settings.covers_path);
|
||||
if (mkdir(dircovers, 0777) == -1) {
|
||||
if(subfoldercheck(dircovers) != 1) {
|
||||
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
|
||||
cntMissFiles = 0;
|
||||
}
|
||||
if(subfoldercreate(Settings.covers_path) != 1) {
|
||||
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
|
||||
cntMissFiles = 0;
|
||||
}
|
||||
}
|
||||
if(stat(Settings.disc_path,&st) != 0) {
|
||||
char dirdiscs[100];
|
||||
snprintf(dirdiscs,strlen(Settings.disc_path),"%s",Settings.disc_path);
|
||||
if (mkdir(dirdiscs, 0777) == -1) {
|
||||
if(subfoldercheck(dirdiscs) != 1) {
|
||||
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
|
||||
cntMissFiles = 0;
|
||||
}
|
||||
if(subfoldercreate(Settings.disc_path) != 1) {
|
||||
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
|
||||
cntMissFiles = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2221,14 +2213,10 @@ int ProgressUpdateWindow()
|
||||
|
||||
struct stat st;
|
||||
if(stat(Settings.update_path, &st) != 0) {
|
||||
char dir[100];
|
||||
snprintf(dir,strlen(Settings.update_path),"%s",Settings.update_path);
|
||||
if (mkdir(dir, 0777) == -1) {
|
||||
if(subfoldercheck(dir) != 1) {
|
||||
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
|
||||
ret = -1;
|
||||
failed = -1;
|
||||
}
|
||||
if(subfoldercreate(Settings.update_path) != 1) {
|
||||
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
|
||||
ret = -1;
|
||||
failed = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,30 +171,6 @@ bool cfg_map(char *name, char *val, short *var, short id)
|
||||
return false;
|
||||
}
|
||||
|
||||
int subfoldercheck(char * dircovers) {
|
||||
//check forsubfolders
|
||||
char dircheck[100];
|
||||
char dirslash[100];
|
||||
int cnt = 0;
|
||||
char * pch;
|
||||
struct stat st;
|
||||
|
||||
sprintf(dirslash, "%s/", dircovers);
|
||||
|
||||
if(stat(dirslash, &st) != 0) {
|
||||
pch = strrchr(dircovers, '/');
|
||||
cnt = pch-dircovers;
|
||||
snprintf(dircheck, cnt+1, "%s", dircovers);
|
||||
subfoldercheck(dircheck);
|
||||
}
|
||||
|
||||
if (mkdir(dircovers, 0777) == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool cfg_bool(char *name, short *var)
|
||||
{
|
||||
return (cfg_map(name, "0", var, 0) || cfg_map(name, "1", var, 1));
|
||||
|
@ -195,7 +195,6 @@ struct Game_NUM* CFG_get_game_num(u8 *id);
|
||||
bool CFG_save_game_opt(u8 *id);
|
||||
bool CFG_save_game_num(u8 *id);
|
||||
bool CFG_forget_game_opt(u8 *id);
|
||||
int subfoldercheck(char * directory);
|
||||
|
||||
//Astidof - Begin of modification
|
||||
enum {
|
||||
|
Loading…
Reference in New Issue
Block a user