From eff1ccfe63370318b0c7c36db188f799ad065c26 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 21 Oct 2023 13:45:44 +0300 Subject: [PATCH] Remove unused functions FileDebug() DirectoryExists() FileCopy() FileMove() --- Standard Gaming Platform/FileMan.cpp | 131 --------------------------- Standard Gaming Platform/FileMan.h | 6 -- 2 files changed, 137 deletions(-) diff --git a/Standard Gaming Platform/FileMan.cpp b/Standard Gaming Platform/FileMan.cpp index bc0d5442..1c43fc2a 100644 --- a/Standard Gaming Platform/FileMan.cpp +++ b/Standard Gaming Platform/FileMan.cpp @@ -191,24 +191,6 @@ void ShutdownFileManager( void ) UnRegisterDebugTopic( TOPIC_FILE_MANAGER, "File Manager" ); } -//************************************************************************** -// -// FileDebug -// -// To set whether or not we should print debug info. -// -// Parameter List : -// Return Value : -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -void FileDebug( BOOLEAN f ) -{ -// gfs.fDebug = f; -} //************************************************************************** // @@ -844,37 +826,6 @@ BOOLEAN GetFileManCurrentDirectory( STRING512 pcDirectory ) } -BOOLEAN DirectoryExists( STRING512 pcDirectory ) -{ - UINT32 uiAttribs; - DWORD uiLastError; - - uiAttribs = GetFileAttributes( pcDirectory ); - - if ( uiAttribs == 0xFFFFFFFF ) - { - // an error, make sure it's the right error - uiLastError = GetLastError(); - - if (uiLastError != ERROR_FILE_NOT_FOUND) - { - FastDebugMsg(String("DirectoryExists: ERROR - GetFileAttributes failed, error #%d on file %s", uiLastError, pcDirectory)); - } - } - else - { - // something's there, make sure it's a directory - if ( uiAttribs & FILE_ATTRIBUTE_DIRECTORY ) - { - return TRUE; - } - } - - // this could also mean that the name given is that of a file, or that an error occurred - return FALSE; -} - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Removes ALL FILES in the specified directory (and all subdirectories with their files if fRecursive is TRUE) // Use EraseDirectory() to simply delete directory contents without deleting the directory itself @@ -960,88 +911,6 @@ void GetFileClose( GETFILESTRUCT *pGFStruct ) } -BOOLEAN FileCopy(STR strSrcFile, STR strDstFile, BOOLEAN fFailIfExists) -{ - return(CopyFile(strSrcFile, strDstFile, fFailIfExists)); - -// Not needed, use Windows CopyFile -/* - HWFILE hFile; - UINT32 uiSize; - CHAR *pBuffer; - UINT32 uiBytesRead, uiBytesWritten; - - - // open source file - hFile = FileOpen(strSrcFile, FILE_ACCESS_READ, FALSE); - if (hFile == 0) - { - FastDebugMsg(String("FileCopy: FileOpen failed on Src file %s", strSrcFile)); - return(FALSE); - } - - // get its size - uiSize = FileGetSize(hFile); - if (uiSize == 0) - { - FastDebugMsg(String("FileCopy: size is 0, Src file %s", strSrcFile)); - FileClose(hFile); - return(FALSE); - } - - // allocate a buffer big enough to hold the entire file - pBuffer = MemAlloc(uiSize); - if (pBuffer == NULL) - { - FastDebugMsg(String("FileCopy: ERROR - MemAlloc pBuffer failed, size %d", uiSize)); - FileClose(hFile); - return(FALSE); - } - - // read the file into memory - if (!FileRead(hFile, pBuffer, uiSize, &uiBytesRead)) - { - FastDebugMsg(String("FileCopy: FileRead failed, file %s", strSrcFile)); - FileClose(hFile); - return(FALSE); - } - - // close source file - FileClose(hFile); - - - // open destination file - hFile = FileOpen(strDstFile, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE); - if (hFile == 0) - { - FastDebugMsg(String("FileCopy: FileOpen failed on Dst file %s", strDstFile)); - return(FALSE); - } - - // write buffer to the destination file - if (!FileWrite(hFile, pBuffer, uiSize, &uiBytesWritten)) - { - FastDebugMsg(String("FileCopy: FileWrite failed, file %s", strDstFile)); - FileClose(hFile); - return(FALSE); - } - - // close destination file - FileClose(hFile); - - - MemFree(pBuffer); - pBuffer = NULL; - return(TRUE); -*/ -} - -BOOLEAN FileMove(STR strOldName, STR strNewName) -{ - // rename - return(MoveFile(strOldName, strNewName)); -} - //Additions by Kris Morness BOOLEAN FileSetAttributes( STR strFilename, UINT32 uiNewAttribs ) { diff --git a/Standard Gaming Platform/FileMan.h b/Standard Gaming Platform/FileMan.h index cf38d7b4..e84f872f 100644 --- a/Standard Gaming Platform/FileMan.h +++ b/Standard Gaming Platform/FileMan.h @@ -102,7 +102,6 @@ extern "C" { extern BOOLEAN InitializeFileManager( STR strIndexFilename ); extern void ShutdownFileManager( void ); -extern void FileDebug( BOOLEAN f ); BOOLEAN FileExists( STR strFilename ); @@ -130,8 +129,6 @@ BOOLEAN SetFileManCurrentDirectory( STR pcDirectory ); BOOLEAN GetFileManCurrentDirectory( STRING512 pcDirectory ); BOOLEAN GetExecutableDirectory( STRING512 pcDirectory ); -BOOLEAN DirectoryExists( STRING512 pcDirectory ); - // WARNING: THESE DELETE ALL FILES IN THE DIRECTORY ( and all subdirectories if fRecursive is TRUE!! ) BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive); BOOLEAN EraseDirectory( STRING512 pcDirectory); @@ -148,9 +145,6 @@ BOOLEAN GetFileFirst( CHAR8 * pSpec, GETFILESTRUCT *pGFStruct ); BOOLEAN GetFileNext( GETFILESTRUCT *pGFStruct ); void GetFileClose( GETFILESTRUCT *pGFStruct ); -BOOLEAN FileCopy(STR strSrcFile, STR strDstFile, BOOLEAN fFailIfExists); -BOOLEAN FileMove(STR strOldName, STR strNewName); - //Added by Kris Morness BOOLEAN FileSetAttributes( STR filename, UINT32 uiNewAttribs ); UINT32 FileGetAttributes( STR filename );