library/src/filesystem/BP-FilesystemRegistry.cc
// Open a handle to the filesystem.
Open a handle to the filesystem.
Open a handle to the filesystem .
P_BP_FSREG BP_FSRegOpen
(
		char *  fs_dir,
		BP_BOOL recurse,
		size_t  max_recurse_depth
)
{
	if(!fs_dir)
		return NULL;
	if(!BP_StringIsReasonablePrintableString(fs_dir, bpstrlen(fs_dir), BP_FALSE, BP_FALSE))
		return NULL;
	P_BP_HASH_TABLE_REGISTRY new_reg = BP_CreateHashTableRegistry();
	if(!new_reg)
		return NULL;
	P_BP_FSREG fs_reg = (P_BP_FSREG) ht_malloc(new_reg, sizeof(BP_FSREG));
	if(!fs_reg)
	{
		BP_DestroyHashTableRegistry(new_reg);
		return NULL;
	}
	fs_reg->hreg = new_reg;
	fs_reg->top_dir = ht_strdup(fs_reg->hreg, fs_dir);
	return fs_reg;
}
P_BP_FSREG BP_FSRegOpen ( char * fs_dir , BP_BOOL recurse , size_t max_recurse_depth ) { if ( ! fs_dir ) return NULL ; if ( ! BP_StringIsReasonablePrintableString ( fs_dir , bpstrlen ( fs_dir ) , BP_FALSE , BP_FALSE ) ) return NULL ; P_BP_HASH_TABLE_REGISTRY new_reg = BP_CreateHashTableRegistry ( ) ; if ( ! new_reg ) return NULL ; P_BP_FSREG fs_reg = ( P_BP_FSREG ) ht_malloc ( new_reg , sizeof ( BP_FSREG ) ) ; if ( ! fs_reg ) { BP_DestroyHashTableRegistry ( new_reg ) ; return NULL ; } fs_reg -> hreg = new_reg ; fs_reg -> top_dir = ht_strdup ( fs_reg -> hreg , fs_dir ) ; return fs_reg ; }
Open a handle to the filesystem.
Open a handle to the filesystem .
// ensure we have a directory // ensure directory string is reasonable // create a new hash table registry // attempt to create our filesystem registry from the newly created hash registry // set hreg (self referencing) // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Attempt to Open Directory %%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // set the top directory // return the filesystem registry