bool
cleanup
This commit is contained in:
@@ -64,7 +64,7 @@ HANDLE DoFindFirstFile( const CString &sPath, WIN32_FIND_DATA *fd )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
int WinMoveFileInternal( const CString &sOldPath, const CString &sNewPath )
|
static bool WinMoveFileInternal( const CString &sOldPath, const CString &sNewPath )
|
||||||
{
|
{
|
||||||
static bool Win9x = false;
|
static bool Win9x = false;
|
||||||
|
|
||||||
@@ -76,29 +76,29 @@ int WinMoveFileInternal( const CString &sOldPath, const CString &sNewPath )
|
|||||||
if( !Win9x )
|
if( !Win9x )
|
||||||
{
|
{
|
||||||
if( MoveFileEx( sOldPath, sNewPath, MOVEFILE_REPLACE_EXISTING ) )
|
if( MoveFileEx( sOldPath, sNewPath, MOVEFILE_REPLACE_EXISTING ) )
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
// On Win9x, MoveFileEx is expected to fail (returns ERROR_CALL_NOT_IMPLEMENTED).
|
// On Win9x, MoveFileEx is expected to fail (returns ERROR_CALL_NOT_IMPLEMENTED).
|
||||||
DWORD err = GetLastError();
|
DWORD err = GetLastError();
|
||||||
if( err == ERROR_CALL_NOT_IMPLEMENTED )
|
if( err == ERROR_CALL_NOT_IMPLEMENTED )
|
||||||
Win9x = true;
|
Win9x = true;
|
||||||
else
|
else
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( MoveFile( sOldPath, sNewPath ) )
|
if( MoveFile( sOldPath, sNewPath ) )
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
if( GetLastError() != ERROR_ALREADY_EXISTS )
|
if( GetLastError() != ERROR_ALREADY_EXISTS )
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if( !DeleteFile( sNewPath ) )
|
if( !DeleteFile( sNewPath ) )
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return MoveFile( sOldPath, sNewPath );
|
return !!MoveFile( sOldPath, sNewPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
int WinMoveFile( CString sOldPath, CString sNewPath )
|
bool WinMoveFile( CString sOldPath, CString sNewPath )
|
||||||
{
|
{
|
||||||
#if defined(_XBOX)
|
#if defined(_XBOX)
|
||||||
sOldPath.Replace( "/", "\\" );
|
sOldPath.Replace( "/", "\\" );
|
||||||
@@ -106,9 +106,9 @@ int WinMoveFile( CString sOldPath, CString sNewPath )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( WinMoveFileInternal(sOldPath, sNewPath) )
|
if( WinMoveFileInternal(sOldPath, sNewPath) )
|
||||||
return 1;
|
return true;
|
||||||
if( GetLastError() != ERROR_ACCESS_DENIED )
|
if( GetLastError() != ERROR_ACCESS_DENIED )
|
||||||
return 0;
|
return false;
|
||||||
/* 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 );
|
||||||
|
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ HANDLE DoFindFirstFile( const CString &sPath, WIN32_FIND_DATA *fd );
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
int WinMoveFile( CString sOldPath, CString sNewPath );
|
bool WinMoveFile( CString sOldPath, CString sNewPath );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(O_BINARY)
|
#if !defined(O_BINARY)
|
||||||
#define O_BINARY 0
|
#define O_BINARY 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool CreateDirectories( CString Path );
|
bool CreateDirectories( CString sPath );
|
||||||
bool PathReady( CString path );
|
bool PathReady( CString sPath );
|
||||||
|
|
||||||
#include "RageUtil_FileDB.h"
|
#include "RageUtil_FileDB.h"
|
||||||
class DirectFilenameDB: public FilenameDB
|
class DirectFilenameDB: public FilenameDB
|
||||||
|
|||||||
Reference in New Issue
Block a user