diff --git a/source/gc/fileOps.c b/source/gc/fileOps.c index ebfbaab8..ba9dd52a 100644 --- a/source/gc/fileOps.c +++ b/source/gc/fileOps.c @@ -15,7 +15,6 @@ en exposed s_fsop fsop structure can be used by callback to update operation sta #include #include -#include //for mkdir #include #include "fileOps.h" @@ -203,16 +202,6 @@ bool fsop_CopyFile (char *source, char *target, progress_callback_t spinner, voi return true; } -/* -Semplified folder make -*/ -int fsop_MakeFolder (char *path) -{ - if (mkdir(path, S_IREAD | S_IWRITE) == 0) return true; - - return false; -} - /* Recursive copyfolder */ @@ -224,9 +213,9 @@ static bool doCopyFolder (char *source, char *target, progress_callback_t spinne bool ret = true; // If target folder doesn't exist, create it ! - if (!fsop_DirExist (target)) + if (!fsop_DirExist(target)) { - fsop_MakeFolder (target); + makedir(target); } pdir=opendir(source); @@ -241,14 +230,14 @@ static bool doCopyFolder (char *source, char *target, progress_callback_t spinne sprintf (newTarget, "%s/%s", target, pent->d_name); // If it is a folder... recurse... - if (fsop_DirExist (newSource)) + if (fsop_DirExist(newSource)) { - ret = doCopyFolder (newSource, newTarget, spinner, spinner_data); + ret = doCopyFolder(newSource, newTarget, spinner, spinner_data); } else // It is a file ! { - strcpy (fsop.op, pent->d_name); - ret = fsop_CopyFile (newSource, newTarget, spinner, spinner_data); + strcpy(fsop.op, pent->d_name); + ret = fsop_CopyFile(newSource, newTarget, spinner, spinner_data); } } diff --git a/source/gc/fileOps.h b/source/gc/fileOps.h index 564a91cb..bf9f7d19 100644 --- a/source/gc/fileOps.h +++ b/source/gc/fileOps.h @@ -36,7 +36,6 @@ u32 fsop_GetFolderKb (char *source); u32 fsop_GetFreeSpaceKb (char *path); bool fsop_DirExist (char *path); bool fsop_CopyFile (char *source, char *target, progress_callback_t spinner, void *spinner_data); -int fsop_MakeFolder (char *path); bool fsop_CopyFolder (char *source, char *target, progress_callback_t spinner, void *spinner_data); #endif diff --git a/source/loader/gc_disc.cpp b/source/loader/gc_disc.cpp index e8b9629d..674dc03e 100644 --- a/source/loader/gc_disc.cpp +++ b/source/loader/gc_disc.cpp @@ -39,6 +39,7 @@ #include "text.hpp" #include "gecko.h" #include "fileOps.h" +#include "defines.h" using namespace std; @@ -164,12 +165,12 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo s32 ret = Disc_ReadGCHeader(&gcheader); Asciify2(gcheader.title); - snprintf(folder, sizeof(folder), "%s:/games/", gamepartition); + snprintf(folder, sizeof(folder), DML_DIR, gamepartition); if(!fsop_DirExist(folder)) - fsop_MakeFolder(folder); + makedir(folder); snprintf(folder, sizeof(folder), "%s:/games/%s [%.06s]%s", gamepartition, gcheader.title, (char *)gcheader.id, j ? "2" : ""); if(!fsop_DirExist(folder)) - fsop_MakeFolder(folder); + makedir(folder); ret = __DiscReadRaw(ReadBuffer, 0, 0x440); if(ret > 0) @@ -230,7 +231,7 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo { snprintf(folder, sizeof(folder), "%s:/games/%s [%.06s]%s/sys", gamepartition, gcheader.title, (char *)gcheader.id, j ? "2" : ""); if(!fsop_DirExist(folder)) - fsop_MakeFolder(folder); + makedir(folder); gprintf("Writing %s/boot.bin\n", folder); snprintf(gamepath, sizeof(gamepath), "%s/boot.bin", folder); diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp index 99fd137a..64375559 100644 --- a/source/menu/menu_wbfs.cpp +++ b/source/menu/menu_wbfs.cpp @@ -7,6 +7,7 @@ #include "fileOps.h" #include "music/SoundHandler.hpp" #include "channel/nand.hpp" +#include "defines.h" using namespace std; @@ -224,8 +225,10 @@ int CMenu::_GCcopyGame(void *obj) { LWP_MutexLock(m.m_mutex); m._setThrdMsg(L"", 0); - if (!fsop_DirExist((char*)"sd:/games")) - fsop_MakeFolder((char*)"sd:/games"); + char folder[MAX_FAT_PATH]; + snprintf(folder, sizeof(folder), DML_DIR, DeviceName[SD]); + if (!fsop_DirExist(folder)) + makedir(folder); char source[MAX_FAT_PATH]; char target[MAX_FAT_PATH]; sprintf(source, "%s:/games/%s", DeviceName[currentPartition], m.m_cf.getHdr()->path);