library/src/filesystem/BP-Filesystem.cc
// checks to see if a directory exists
checks to see if a directory exists
checks to see if a directory exists
BP_BOOL BP_FSDirectoryExists(char *filesystem_path)
{
	if(!filesystem_path)
		return BP_FALSE;
	if(!BP_StringIsReasonableForUnixEXT4Directory(filesystem_path, bpstrlen(filesystem_path), BP_FALSE))
		return BP_FALSE;
	struct stat file_stat;
	BP_ZERO_STACK(file_stat);
	if(stat(filesystem_path, &file_stat) == -1)
	{
		return BP_FALSE;
	}
	if(S_ISDIR(file_stat.st_mode))
		return BP_TRUE;
	return BP_TRUE;
}
BP_BOOL BP_FSDirectoryExists ( char * filesystem_path ) { if ( ! filesystem_path ) return BP_FALSE ; if ( ! BP_StringIsReasonableForUnixEXT4Directory ( filesystem_path , bpstrlen ( filesystem_path ) , BP_FALSE ) ) return BP_FALSE ; struct stat file_stat ; BP_ZERO_STACK ( file_stat ) ; if ( stat ( filesystem_path , & file_stat ) == -1 ) { return BP_FALSE ; } if ( S_ISDIR ( file_stat . st_mode ) ) return BP_TRUE ; return BP_TRUE ; }
checks to see if a directory exists
checks to see if a directory exists
// ensure we have a filesystem path // check that path is reasonable // create stat information // attempt to stat file // return false if it doesn't exist // if the item is a directory, return true // if it isn't a directory, return false