Xbox : Correct the path correction routine. We are now back.
This commit is contained in:
@@ -271,7 +271,7 @@ RageFileObjDirect::~RageFileObjDirect()
|
|||||||
CString sNewPath = m_sPath;
|
CString sNewPath = m_sPath;
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
if( WinMoveFile(sOldPath, sNewPath) )
|
if( WinMoveFile(DoPathReplace(sOldPath), DoPathReplace(sNewPath)) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* We failed. */
|
/* We failed. */
|
||||||
|
|||||||
@@ -21,47 +21,45 @@
|
|||||||
/* Wrappers for low-level file functions, to work around Xbox issues: */
|
/* Wrappers for low-level file functions, to work around Xbox issues: */
|
||||||
int DoMkdir( const CString &sPath, int perm )
|
int DoMkdir( const CString &sPath, int perm )
|
||||||
{
|
{
|
||||||
CString TempPath = sPath;
|
return mkdir( DoPathReplace(sPath), perm );
|
||||||
TempPath.Replace( "/", "\\" );
|
|
||||||
return mkdir( TempPath );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoOpen( const CString &sPath, int flags, int perm )
|
int DoOpen( const CString &sPath, int flags, int perm )
|
||||||
{
|
{
|
||||||
CString TempPath = sPath;
|
return open( DoPathReplace(sPath), flags, perm );
|
||||||
TempPath.Replace( "/", "\\" );
|
|
||||||
return open( TempPath, flags, perm );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoStat( const CString &sPath, struct stat *st )
|
int DoStat( const CString &sPath, struct stat *st )
|
||||||
{
|
{
|
||||||
CString TempPath = sPath;
|
return stat( DoPathReplace(sPath), st );
|
||||||
TempPath.Replace( "/", "\\" );
|
|
||||||
return stat( sPath, st );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoRemove( const CString &sPath )
|
int DoRemove( const CString &sPath )
|
||||||
{
|
{
|
||||||
CString TempPath = sPath;
|
return remove( DoPathReplace(sPath) );
|
||||||
TempPath.Replace( "/", "\\" );
|
|
||||||
return remove( sPath );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoRmdir( const CString &sPath )
|
int DoRmdir( const CString &sPath )
|
||||||
{
|
{
|
||||||
CString TempPath = sPath;
|
return rmdir( DoPathReplace(sPath) );
|
||||||
TempPath.Replace( "/", "\\" );
|
|
||||||
return rmdir( sPath );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE DoFindFirstFile( const CString &sPath, WIN32_FIND_DATA *fd )
|
HANDLE DoFindFirstFile( const CString &sPath, WIN32_FIND_DATA *fd )
|
||||||
{
|
{
|
||||||
CString TempPath = sPath;
|
return FindFirstFile( DoPathReplace(sPath), fd );
|
||||||
TempPath.Replace( "/", "\\" );
|
|
||||||
return FindFirstFile( TempPath, fd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
CString DoPathReplace(const CString &sPath)
|
||||||
|
{
|
||||||
|
CString TempPath = sPath;
|
||||||
|
#if defined(XBOX)
|
||||||
|
TempPath.Replace( "//", "\\" );
|
||||||
|
TempPath.Replace( "/", "\\" );
|
||||||
|
#endif
|
||||||
|
return TempPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
static bool WinMoveFileInternal( const CString &sOldPath, const CString &sNewPath )
|
static bool WinMoveFileInternal( const CString &sOldPath, const CString &sNewPath )
|
||||||
@@ -100,11 +98,6 @@ static bool WinMoveFileInternal( const CString &sOldPath, const CString &sNewPat
|
|||||||
|
|
||||||
bool WinMoveFile( CString sOldPath, CString sNewPath )
|
bool WinMoveFile( CString sOldPath, CString sNewPath )
|
||||||
{
|
{
|
||||||
#if defined(_XBOX)
|
|
||||||
sOldPath.Replace( "/", "\\" );
|
|
||||||
sNewPath.Replace( "/", "\\" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( WinMoveFileInternal(sOldPath, sNewPath) )
|
if( WinMoveFileInternal(sOldPath, sNewPath) )
|
||||||
return true;
|
return true;
|
||||||
if( GetLastError() != ERROR_ACCESS_DENIED )
|
if( GetLastError() != ERROR_ACCESS_DENIED )
|
||||||
@@ -112,7 +105,7 @@ bool WinMoveFile( CString sOldPath, CString sNewPath )
|
|||||||
/* Try turning off the read-only bit on the file we're overwriting. */
|
/* Try turning off the read-only bit on the file we're overwriting. */
|
||||||
SetFileAttributes( sNewPath, FILE_ATTRIBUTE_NORMAL );
|
SetFileAttributes( sNewPath, FILE_ATTRIBUTE_NORMAL );
|
||||||
|
|
||||||
return WinMoveFileInternal( sOldPath, sNewPath );
|
return WinMoveFileInternal( DoPathReplace(sOldPath), DoPathReplace(sNewPath) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -290,7 +283,7 @@ void DirectFilenameDB::PopulateFileSet( FileSet &fs, const CString &path )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2004 Glenn Maynard, Chris Danford
|
* Copyright (c) 2003-2005 Glenn Maynard, Chris Danford, Renaud Lepage
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ HANDLE DoFindFirstFile( const CString &sPath, WIN32_FIND_DATA *fd );
|
|||||||
#define DoRemove remove
|
#define DoRemove remove
|
||||||
#define DoRmdir rmdir
|
#define DoRmdir rmdir
|
||||||
#endif
|
#endif
|
||||||
|
CString DoPathReplace( const CString &sPath );
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
bool WinMoveFile( CString sOldPath, CString sNewPath );
|
bool WinMoveFile( CString sOldPath, CString sNewPath );
|
||||||
|
|||||||
Reference in New Issue
Block a user