replace per-platform DIR_SEP and DIR_SEP_CHR with "/" and '/', cleanup some wii fs things, made CWII_IPC_HLE_Device_fs::ExecuteCommand DELETE_FILE also delete the device if it's a dir.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1406 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
116509985a
commit
5c805163bf
|
@ -78,7 +78,7 @@ bool Delete(const char *filename)
|
|||
if (IsDirectory(filename))
|
||||
return false;
|
||||
#ifdef _WIN32
|
||||
DeleteFile(filename);
|
||||
DeleteFile(SanitizePath(filename).c_str());
|
||||
#else
|
||||
unlink(filename);
|
||||
#endif
|
||||
|
@ -222,7 +222,7 @@ bool DeleteDir(const char *filename)
|
|||
|
||||
bool Rename(const char *srcFilename, const char *destFilename)
|
||||
{
|
||||
return (rename(srcFilename, destFilename) == 0);
|
||||
return (rename(SanitizePath(srcFilename).c_str(), SanitizePath(destFilename).c_str()) == 0);
|
||||
}
|
||||
|
||||
bool Copy(const char *srcFilename, const char *destFilename)
|
||||
|
|
|
@ -4,14 +4,13 @@
|
|||
#ifdef _WIN32
|
||||
#define PLUGIN_PREFIX ""
|
||||
#define PLUGIN_SUFFIX ".dll"
|
||||
#define DIR_SEP "\\"
|
||||
#define DIR_SEP_CHR '\\'
|
||||
#else
|
||||
#define PLUGIN_PREFIX "lib"
|
||||
#define PLUGIN_SUFFIX ".so"
|
||||
#endif
|
||||
|
||||
#define DIR_SEP "/"
|
||||
#define DIR_SEP_CHR '/'
|
||||
#endif
|
||||
|
||||
#define PLUGINS_DIR "Plugins"
|
||||
#define ROOT_DIR "."
|
||||
|
@ -75,7 +74,8 @@
|
|||
//#define GC_USER_USA_DIR FULL_GC_USER_DIR USA_DIR
|
||||
//#define GC_USER_JAP_DIR FULL_GC_USER_DIR JAP_DIR
|
||||
|
||||
#define FULL_WII_USER_DIR FULL_USERDATA_DIR WII_USER_DIR DIR_SEP // Currently this is used as the "root" for Wii fs, is that correct?
|
||||
#define FULL_WII_USER_DIR FULL_USERDATA_DIR WII_USER_DIR DIR_SEP
|
||||
#define FULL_WII_ROOT_DIR FULL_USERDATA_DIR WII_USER_DIR // This is the "root" for Wii fs, so that it may be used with created devices
|
||||
|
||||
#define FULL_GAMECONFIG_DIR FULL_USERDATA_DIR GAMECONFIG_DIR DIR_SEP
|
||||
#define FULL_CONFIG_DIR FULL_USERDATA_DIR CONFIG_DIR DIR_SEP
|
||||
|
|
|
@ -230,7 +230,7 @@ void CopySettingsFile(std::string DeviceName)
|
|||
else
|
||||
Source += "setting-eur.txt";
|
||||
|
||||
std::string Target = FULL_WII_USER_DIR + File::SanitizePath(DeviceName.c_str());
|
||||
std::string Target = FULL_WII_ROOT_DIR + DeviceName;
|
||||
|
||||
// Check if the target dir exists, otherwise create it
|
||||
std::string TargetDir = Target.substr(0, Target.find_last_of(DIR_SEP));
|
||||
|
@ -433,7 +433,6 @@ void ExecuteCommand(u32 _Address)
|
|||
g_ReplyQueue.push(std::pair<u32, std::string>(_Address, "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// This is called continuously and WII_IPCInterface::IsReady() is controlled from WII_IPC.cpp.
|
||||
|
|
|
@ -29,11 +29,11 @@ std::string HLE_IPC_BuildFilename(const char* _pFilename, int _size)
|
|||
char Buffer[128];
|
||||
memcpy(Buffer, _pFilename, _size);
|
||||
|
||||
std::string Filename(FULL_WII_USER_DIR);
|
||||
std::string Filename(FULL_WII_ROOT_DIR);
|
||||
if (Buffer[1] == '0')
|
||||
Filename += std::string("title"); // this looks and feel like an hack...
|
||||
Filename += std::string("/title"); // this looks and feel like an hack...
|
||||
|
||||
Filename += File::SanitizePath(Buffer);
|
||||
Filename += Buffer;
|
||||
|
||||
return Filename;
|
||||
}
|
||||
|
|
|
@ -377,6 +377,10 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
|||
{
|
||||
LOG(WII_IPC_FILEIO, "FS: DeleteFile %s", Filename.c_str());
|
||||
}
|
||||
else if (File::DeleteDir(Filename.c_str()))
|
||||
{
|
||||
LOG(WII_IPC_FILEIO, "FS: DeleteDir %s", Filename.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WII_IPC_FILEIO, "FS: DeleteFile %s - failed!!!", Filename.c_str());
|
||||
|
|
Loading…
Reference in New Issue