it seems that "rename" overwrites files...
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1086 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
2e4cde02fd
commit
03d5443636
|
@ -163,6 +163,11 @@ bool DeleteDir(const char *filename)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Rename(const char *srcFilename, const char *destFilename)
|
||||||
|
{
|
||||||
|
return (rename(srcFilename, destFilename) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetUserDirectory()
|
std::string GetUserDirectory()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -43,6 +43,7 @@ bool IsDirectory(const char *filename);
|
||||||
bool CreateDir(const char *filename);
|
bool CreateDir(const char *filename);
|
||||||
bool Delete(const char *filename);
|
bool Delete(const char *filename);
|
||||||
bool DeleteDir(const char *filename);
|
bool DeleteDir(const char *filename);
|
||||||
|
bool Rename(const char *srcFilename, const char *destFilename);
|
||||||
u64 GetSize(const char *filename);
|
u64 GetSize(const char *filename);
|
||||||
std::string GetUserDirectory();
|
std::string GetUserDirectory();
|
||||||
bool CreateEmptyFile(const char *filename);
|
bool CreateEmptyFile(const char *filename);
|
||||||
|
|
|
@ -328,9 +328,17 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||||
std::string FilenameRename = HLE_IPC_BuildFilename((const char*)Memory::GetPointer(_BufferIn+Offset), 64);
|
std::string FilenameRename = HLE_IPC_BuildFilename((const char*)Memory::GetPointer(_BufferIn+Offset), 64);
|
||||||
Offset += 64;
|
Offset += 64;
|
||||||
|
|
||||||
// F|RES: i think that we dont need this - CreateDirectoryStruct(Filename);
|
// try to make the basis directory
|
||||||
|
CreateDirectoryStruct(Filename);
|
||||||
|
|
||||||
if (rename(Filename.c_str(), FilenameRename.c_str()) == 0)
|
// if there is already a filedelete it
|
||||||
|
if (File::Exists(FilenameRename.c_str()))
|
||||||
|
{
|
||||||
|
File::Delete(FilenameRename.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// finally try to rename the file
|
||||||
|
if (File::Rename(Filename.c_str(), FilenameRename.c_str()))
|
||||||
{
|
{
|
||||||
LOG(WII_IPC_FILEIO, "FS: Rename %s to %s", Filename.c_str(), FilenameRename.c_str());
|
LOG(WII_IPC_FILEIO, "FS: Rename %s to %s", Filename.c_str(), FilenameRename.c_str());
|
||||||
}
|
}
|
||||||
|
@ -354,9 +362,9 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||||
std::string Filename(HLE_IPC_BuildFilename((const char*)Memory::GetPointer(Addr), 64));
|
std::string Filename(HLE_IPC_BuildFilename((const char*)Memory::GetPointer(Addr), 64));
|
||||||
Addr += 64;
|
Addr += 64;
|
||||||
|
|
||||||
u8 OwnerPerm = Memory::Read_U8(Addr); Addr++;
|
u8 OwnerPerm = Memory::Read_U8(Addr); Addr++;
|
||||||
u8 GroupPerm = Memory::Read_U8(Addr); Addr++;
|
u8 GroupPerm = Memory::Read_U8(Addr); Addr++;
|
||||||
u8 OtherPerm = Memory::Read_U8(Addr); Addr++;
|
u8 OtherPerm = Memory::Read_U8(Addr); Addr++;
|
||||||
u8 Attributes = Memory::Read_U8(Addr); Addr++;
|
u8 Attributes = Memory::Read_U8(Addr); Addr++;
|
||||||
|
|
||||||
LOG(WII_IPC_FILEIO, "FS: CreateFile %s", Filename.c_str());
|
LOG(WII_IPC_FILEIO, "FS: CreateFile %s", Filename.c_str());
|
||||||
|
|
Loading…
Reference in New Issue