[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paragui-cvs] CVS: paragui/src/core pgfilearchive.cpp,1.2,1.2.4.1
From: |
Alexander Pipelka <address@hidden> |
Subject: |
[paragui-cvs] CVS: paragui/src/core pgfilearchive.cpp,1.2,1.2.4.1 |
Date: |
Tue, 28 May 2002 05:41:48 -0400 |
Update of /cvsroot/paragui/paragui/src/core
In directory subversions:/tmp/cvs-serv458/src/core
Modified Files:
Tag: devel-1-0
pgfilearchive.cpp
Log Message:
Added patch from Andrew Ford <address@hidden>
This one adds
PG_FileArchive::GetFileList()
PG_FileArchive::GetSearchPathList()
returning a vector of strings.
Index: pgfilearchive.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgfilearchive.cpp,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -r1.2 -r1.2.4.1
*** pgfilearchive.cpp 26 Apr 2002 12:43:22 -0000 1.2
--- pgfilearchive.cpp 28 May 2002 09:41:44 -0000 1.2.4.1
***************
*** 108,111 ****
--- 108,137 ----
}
+ PG_FileList* PG_FileArchive::GetFileList(const char *dir) {
+ char **tempList = EnumerateFiles(dir);
+
+ if( tempList == NULL ) {
+ return NULL;
+ }
+
+ PG_FileList* retVal = NULL;
+
+ // Scan through to get the length of the listing to get the proper
vector size.
+ Uint32 size = 0;
+ for( size = 0; tempList[ size ] != NULL; ++size) {}
+
+ // Now we're ready to initialize everything.
+ retVal = new std::vector< std::string >;
+ retVal->reserve( size );
+ for( Uint32 i = 0; i < size; ++i ) {
+ retVal->push_back(std::string(tempList[ i ]));
+ }
+
+ // Clean up.
+ PHYSFS_freeList(tempList);
+
+ return retVal;
+ }
+
bool PG_FileArchive::Exists(const char *filename) {
return PHYSFS_exists(filename);
***************
*** 287,290 ****
--- 313,342 ----
char** PG_FileArchive::GetSearchPath() {
return PHYSFS_getSearchPath();
+ }
+
+ PG_FileList* PG_FileArchive::GetSearchPathList() {
+ char **tempList = PHYSFS_getSearchPath();
+
+ if( tempList == NULL ) {
+ return NULL;
+ }
+
+ PG_FileList* retVal = NULL;
+
+ // Scan through to get the length of the listing to get the proper
vector size.
+ Uint32 size = 0;
+ for(; tempList[ size ] != NULL; ++size) {}
+
+ // Now we're ready to initialize everything.
+ retVal = new std::vector< std::string >;
+ retVal->reserve( size );
+ for( Uint32 i = 0; i < size; ++i ) {
+ retVal->push_back(std::string(tempList[ i ]));
+ }
+
+ // Clean up.
+ PHYSFS_freeList(tempList);
+
+ return retVal;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paragui-cvs] CVS: paragui/src/core pgfilearchive.cpp,1.2,1.2.4.1,
Alexander Pipelka <address@hidden> <=