Example #1
0
static void STD_Resource( DaoProcess *proc, DaoValue *p[], int N )
{
	FILE *fin;
	DString *file = DString_Copy( p[0]->xString.data );
	if( DaoVmSpace_SearchResource( proc->vmSpace, file ) == 0 ){
		DaoProcess_RaiseException( proc, DAO_ERROR, "resource file not found" );
		DString_Delete( file );
		return;
	}
	DaoVmSpace_ReadSource( proc->vmSpace, file, file );
	DaoProcess_PutString( proc, file );
	DString_Delete( file );
}
Example #2
0
static void DaoSTD_Resource( DaoProcess *proc, DaoValue *p[], int N )
{
	FILE *fin;
	DString *file = DString_Copy( p[0]->xString.value );
	if( DaoVmSpace_SearchResource( proc->vmSpace, file, proc->activeNamespace->path ) == 0 ){
		DString_InsertChars( file, "resource file not found: ", 0, 0, -1 );
		DaoProcess_RaiseError( proc, NULL, file->chars );
		DString_Delete( file );
		return;
	}
	DaoVmSpace_ReadFile( proc->vmSpace, file, file );
	DaoProcess_PutString( proc, file );
	DString_Delete( file );
}
Example #3
0
int DaoxResource_SearchFile( DaoxResource *self, DString *fname, DString *search )
{
	DString *tmp;

	if( DaoVmSpace_SearchResource( self->vmSpace, fname, search ) ) return 1;
	tmp = DString_Copy( fname );
	Dao_MakePath( search, tmp );
	if( DaoVmSpace_TestFile( self->vmSpace, tmp ) ){
		DString_Assign( fname, tmp );
		DString_Delete( tmp );
		return 1;
	}
	DString_Delete( tmp );
	return 0;
}