-fixed codedump when trying to install or copy

gamecube games to partitions without games folder
on it, dumping to ntfs was not broken it just havent
created the folder properly :)
This commit is contained in:
fix94.1 2012-03-02 17:45:08 +00:00
parent 152bde2c36
commit f557b7241e
4 changed files with 16 additions and 24 deletions

View File

@ -15,7 +15,6 @@ en exposed s_fsop fsop structure can be used by callback to update operation sta
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h> //for mkdir
#include <sys/statvfs.h>
#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);
}
}

View File

@ -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

View File

@ -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);

View File

@ -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);