mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
Container.cpp & .h delete (#242)
* Remove GetFilesInDirectory() * Remove BuildFileDirectory * Remove container.cpp & .h Not used in the code
This commit is contained in:
@@ -36,7 +36,6 @@
|
||||
#include "MemMan.h"
|
||||
#include "Debug.h"
|
||||
#include "RegInst.h"
|
||||
#include "Container.h"
|
||||
#include "LibraryDataBase.h"
|
||||
#include "io.h"
|
||||
#include "sgp_logger.h"
|
||||
@@ -149,8 +148,6 @@ void W32toSGPFileFind( GETFILESTRUCT *pGFStruct, WIN32_FIND_DATA *pW32Struct );
|
||||
HANDLE GetHandleToRealFile( HWFILE hFile, BOOLEAN *pfDatabaseFile );
|
||||
HWFILE CreateFileHandle( HANDLE hRealFile, BOOLEAN fDatabaseFile );
|
||||
void DestroyFileHandle( HWFILE hFile );
|
||||
void BuildFileDirectory( void );
|
||||
INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *, HANDLE hFile, WIN32_FIND_DATA *pFind );
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
@@ -950,169 +947,6 @@ void DestroyFileHandle( HWFILE hFile )
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// BuildFileDirectory
|
||||
//
|
||||
//
|
||||
//
|
||||
// Parameter List :
|
||||
// Return Value :
|
||||
// Modification history :
|
||||
//
|
||||
// ??nov96:HJH ->creation
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
void BuildFileDirectory( void )
|
||||
{
|
||||
|
||||
return; // temporary until container stuff is fixed
|
||||
/*
|
||||
INT32 i, iNumFiles = 0;
|
||||
HANDLE hFile, hFileIn;
|
||||
WIN32_FIND_DATA find, inFind;
|
||||
BOOLEAN fMore = TRUE;
|
||||
CHAR cName[FILENAME_LENGTH], cDir[FILENAME_LENGTH], cSubDir[FILENAME_LENGTH];
|
||||
HCONTAINER hStack;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// First, push all the file names in the directory (and subdirectories)
|
||||
// onto the stack.
|
||||
//
|
||||
|
||||
GetProfileChar( "Startup", "InstPath", "", cDir );
|
||||
|
||||
if ( strlen( cDir ) == 0 )
|
||||
return;
|
||||
|
||||
hStack = CreateStack( 100, FILENAME_LENGTH );
|
||||
if (hStack == NULL)
|
||||
{
|
||||
FastDebugMsg(String("BuildFileDirectory: CreateStack Failed for the filename stack"));
|
||||
return;
|
||||
}
|
||||
|
||||
find.dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY;
|
||||
|
||||
strcpy( &(cDir[strlen(cDir)]), "\\*.*\0" );
|
||||
hFile = FindFirstFile( cDir, &find );
|
||||
while ( fMore )
|
||||
{
|
||||
if ( find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
||||
{
|
||||
if ( strcmp( find.cFileName, "." ) != 0 && strcmp( find.cFileName, ".." ) != 0 )
|
||||
{
|
||||
// a valid directory
|
||||
inFind.dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY;
|
||||
strcpy( cSubDir, cDir );
|
||||
strcpy( &(cSubDir[strlen(cDir)-3]), find.cFileName );
|
||||
strcpy( &(cSubDir[strlen(cSubDir)]), "\\*.*\0" );
|
||||
hFileIn = FindFirstFile( cSubDir, &inFind );
|
||||
iNumFiles += GetFilesInDirectory( hStack, cSubDir, hFileIn, &inFind );
|
||||
FindClose( hFileIn );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iNumFiles++;
|
||||
strcpy( cName, cDir );
|
||||
strcpy( &(cName[strlen(cName)-3]), find.cFileName );
|
||||
CharLower( cName );
|
||||
hStack = Push( hStack, cName );
|
||||
}
|
||||
find.dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY;
|
||||
fMore = FindNextFile( hFile, &find );
|
||||
}
|
||||
FindClose( hFile );
|
||||
|
||||
//
|
||||
// Okay, we have all the files in the stack, now put them in place.
|
||||
//
|
||||
gfs.uiNumFilesInDirectory = iNumFiles;
|
||||
|
||||
gfs.pcFileNames = (STR8)MemAlloc( iNumFiles * FILENAME_LENGTH );
|
||||
|
||||
if ( gfs.pcFileNames )
|
||||
{
|
||||
for ( i=0 ; i<iNumFiles ; i++ )
|
||||
{
|
||||
Pop( hStack, (void *)(&gfs.pcFileNames[i*FILENAME_LENGTH]) );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Clean up.
|
||||
//
|
||||
|
||||
DeleteStack( hStack );
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// GetFilesInDirectory
|
||||
//
|
||||
// Gets the files in a directory and the subdirectories.
|
||||
//
|
||||
// Parameter List :
|
||||
// Return Value :
|
||||
// Modification history :
|
||||
//
|
||||
// ??nov96:HJH ->creation
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *pcDir, HANDLE hFile, WIN32_FIND_DATA *pFind )
|
||||
{
|
||||
INT32 iNumFiles;
|
||||
WIN32_FIND_DATA inFind;
|
||||
BOOLEAN fMore;
|
||||
CHAR cName[FILENAME_LENGTH], cDir[FILENAME_LENGTH];
|
||||
HANDLE hFileIn;
|
||||
|
||||
fMore = TRUE;
|
||||
iNumFiles = 0;
|
||||
|
||||
while ( fMore )
|
||||
{
|
||||
if ( pFind->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
||||
{
|
||||
if ( strcmp( pFind->cFileName, "." ) != 0 && strcmp( pFind->cFileName, ".." ) != 0 )
|
||||
{
|
||||
// a valid directory - recurse and find the files in that directory
|
||||
|
||||
inFind.dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY;
|
||||
strcpy( cDir, pcDir );
|
||||
strcpy( &(cDir[strlen(cDir)-3]), pFind->cFileName );
|
||||
strcpy( &(cDir[strlen(cDir)]), "\\*.*\0" );
|
||||
hFileIn = FindFirstFile( cDir, &inFind );
|
||||
iNumFiles += GetFilesInDirectory( hStack, cDir, hFileIn, &inFind );
|
||||
FindClose( hFileIn );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iNumFiles++;
|
||||
strcpy( cName, pcDir );
|
||||
strcpy( &(cName[strlen(cName)-3]), pFind->cFileName );
|
||||
CharLower( cName );
|
||||
hStack = Push( hStack, cName );
|
||||
}
|
||||
pFind->dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY;
|
||||
fMore = FindNextFile( hFile, pFind );
|
||||
}
|
||||
|
||||
return(iNumFiles);
|
||||
}
|
||||
|
||||
BOOLEAN SetFileManCurrentDirectory( STR pcDirectory )
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user