Beispiel #1
0
//----------------------------------------------------------------//
ZIPFSZipFileEntry* ZIPFSZipFile_FindEntry ( ZIPFSZipFile* self, char const* filename ) {

	ZIPFSZipFileDir* dir;
	ZIPFSZipFileEntry* entry;
	int i;
	
	i = strlen ( filename ) - 1;
	if ( filename [ i ] == '/' ) return 0;
	
	dir = ZIPFSZipFile_FindDir ( self, filename );
	if ( !dir ) return 0;
	
	for ( ; i >= 0; --i ) {
		if ( filename [ i ] == '/' ) {
			filename = &filename [ i + 1 ];
			break;
		}
	}
	
	entry = dir->mChildFiles;
	for ( ; entry; entry = entry->mNext ) {
		if ( strcmp_ignore_case ( entry->mName, filename ) == 0 ) break;
	}

	return entry;
}
Beispiel #2
0
//----------------------------------------------------------------//
ZIPFSDIR* zipfs_dir_open ( void ) {

	ZIPFSDir* self = ( ZIPFSDir* )calloc ( 1, sizeof ( ZIPFSDir ));
	ZIPFSVirtualPath* mount = find_best_virtual_path ( sWorkingPath->mMem );
	
	self->mDirName = copy_string ( sWorkingPath->mMem );
	self->mDirNameLen = sWorkingPath->mStrLen;
	
	if ( mount ) {
		char const* path = ZIPFSVirtualPath_GetLocalPath ( mount, sWorkingPath->mMem );
		self->mZipFileDir = ZIPFSZipFile_FindDir ( mount->mArchive, path );
	}
	else {
		self->mVirtualSubDir = find_next_virtual_subdir ( self->mDirName, 0 );
	}
	
	#ifndef _WIN32
		self->mHandle = opendir ( "." );
	#endif
	
	return ( ZIPFSDIR* )self;
}