
/* Generated by Interface Builder */

#import "CardImage.h"
#import <appkit/appkit.h>
#import	<libc.h>
#import	<strings.h>

@implementation CardImage


	static int	file_find_func( const char *, const char ** );


- initFromFile:( const char * )fileName
{

	char 		*fname = alloca( strlen( NXArgv[ 0 ]) + 
								strlen( CARDS_DIR ) + 
								strlen( fileName ) + 8 ),
				*slashPos;
	
		
												// Generally the cards will be found in a 
												//	subdirectory of the application.
												//	Build that directory path.
	strcpy( fname, NXArgv[ 0 ]);
	if( slashPos = strrchr( fname, '/' ))
		sprintf( slashPos + 1, CARDS_DIR"/%s", fileName );
	else
		sprintf( fname, "./"CARDS_DIR"/%s", fileName );

												// Instruct the super class to perform
												//	the initialization using the full path
												//	file name.
	return [ super initFromFile:fname ];
}


/*
 * This function is called by the NeXT file path search
 *	routine when it finds the indicated file.
 * Since this routine isn't called unless the file is found,
 *	then the work is done.
 * The routine simply stores the file in a pointer variable
 *	so that it can be exec()'d
 */
static int	file_find_func( const char *fname, const char **retPtr )
{


	*retPtr = fname;
	
	return 0;
}


@end
