示例#1
0
// write package data ---------------------------------------------------------
//
PRIVATE
int WritePackageFile( const char* packname, list_item_s *listitems, int numitems )
{
	ASSERT( packname != NULL );
	ASSERT( listitems != NULL );
	ASSERT( numitems > 0 );

	Printf( "creating file package \"%s\" ...", packname );
	fflush( stdout );

	// create package file
	FILE *fp = fopen( packname, "wb" );
	if ( fp == NULL ) {
		Err_Printf( "\ncannot create output file: %s\n", strerror( errno ) );
		return FALSE;
	}

	if ( !WritePackageHeader( fp, listitems, numitems ) ) {
		fclose( fp );
		return FALSE;
	}

	if ( !WritePackageData( fp, listitems, numitems ) ) {
		fclose( fp );
		return FALSE;
	}

	fclose( fp );
	return TRUE;
}
示例#2
0
/**
GenerateOutput: Generates IBY file for the given package file

@internalComponent
@released

@param aPkgFile - package file name
@param aParser - corresponding package file reader object
*/
void Sis2Iby::GenerateIby(String aPkgFile, PPKGPARSER aParser)
{
    String ibyFile = iOutputPath;

    AppendFileName(ibyFile, aPkgFile);
    ibyFile.append(".iby");

    if( !MakeDirectory(iOutputPath) )
        throw SisUtilsException(iOutputPath.c_str(),"Failed to create path");

    if(IsVerboseMode())
    {
        std::cout << "Generating IBY file " << ibyFile.c_str() << std::endl;
    }

    ibyHandle.open((char*)ibyFile.data(),(std::ios::out));

    if(!ibyHandle.good())
    {
        throw SisUtilsException(ibyFile.c_str(),"Failed to create IBY file");
    }

    // Generating Header
    MakeFullPath(aPkgFile);
    ibyHandle << "\n// Generated IBY file for the package file: ";
    ibyHandle << aPkgFile;

    // Language Supported
    WriteLanguages(aParser);

    // Package Header
    WritePackageHeader(aParser);

    // Install options list
    WriteInstallOptions(aParser);

    // Package Body
    WritePackageBody(aParser);

    ibyHandle.close();
}