예제 #1
0
I_OStream* GetEmbFilesLog( void )
{
static I_OStream_Ptr sLogFile = NULL;

	if( sLogFile == NULL )
	{
		I_Disk_Location_Ptr pLoc = CreateDiskLocation( "FBL_EmbeddedFiles.txt" );
		
		I_IStream_Ptr pIStream = CreateTextStream(pLoc);
		sLogFile = fbl_dynamic_cast<I_OStream>(pIStream);
	}
	
	return sLogFile.get();
}
예제 #2
0
I_Disk_Location_Ptr Directory::NextItem( void ) 
{
	I_Disk_Location_Ptr pLocation = nullptr;

#if FBL_WIN
	WIN32_FIND_DATAW FileData;
	if ( mStarted )
	{
		if ( !::FindNextFileW( mDirent, &FileData) )
			StopIteration();
	}
	else
	{
		if ( mDirent )
			StopIteration();

		String file_path( mpLocation->get_Path());
		if( file_path.charAt( file_path.length()-1 ) != I_Disk_Location::sPathDelimiterU )
			file_path += I_Disk_Location::sPathDelimiterU;
		file_path += "*";

		mDirent = ::FindFirstFileW( file_path.c_str(), &FileData ); 
		if ( mDirent == INVALID_HANDLE_VALUE )
			mDirent = NULL;
		else
			mStarted = true;
	}

	if ( mDirent )
	{
		String file_path( mpLocation->get_Path() );
		if( file_path.charAt( file_path.length()-1 ) != I_Disk_Location::sPathDelimiterU )
			file_path += I_Disk_Location::sPathDelimiterU;
		file_path += FileData.cFileName;
		pLocation = fbl_dynamic_cast<I_Disk_Location>(CreateDiskLocation( file_path.c_str() ) );
	}
#endif // FBL_WIN


#if FBL_POSIX_API
	dirent* pDirent = ::readdir( mDirent );
	
	if( pDirent )
	{	
		String file_path( mpLocation->get_Path().c_str() );
		if( file_path.charAt( file_path.length()-1 ) != I_Disk_Location::sPathDelimiterU )
			file_path += Location::sPathDelimiterU;
		file_path += pDirent->d_name;

		pLocation = new Location( file_path.c_str() );
		pLocation->put_IsDirectory( bool(pDirent->d_type == DT_DIR) );
	}	
#endif // FBL_POSIX_API		


#if FBL_MAC && !FBL_MAC_MACHO
	bool IsDirectory;
	Str255 pasName;

	((DirData*) mDirent)->Read( pasName, IsDirectory );
	
	if( pasName[0] > 0 )
	{
		Location_Disk_FSSpec_Ptr pLocSpec = fbl_dynamic_cast<Location_Disk_FSSpec>(mpLocation);
		const FSSpec* pThisDirectory = pLocSpec->get_FSSpec();

		FSSpec childSpec;
		FSMakeFSSpec( pThisDirectory->vRefNum, ((DirData*) mDirent)->GetDirID(), pasName, &childSpec );
		
		pLocation = CreateDiskLocationFromFSSpec( &childSpec );
		pLocation->put_IsDirectory( IsDirectory );
	}
#endif // FBL_MAC && !FBL_MAC_MACHO

	return pLocation; 
}