예제 #1
0
FILE *PathList::OpenFileInPath( char *filename, char *mode )
{
	FILE*     file;
	int i;
	char buf[1024];

	/* open the file */
	file = fopen( filename, mode );

	/* if we couldn't find it, search the alternate paths */
	if (!file) 
		for (i=0;i<GetNumPaths(); i++)
		{
			sprintf( buf, "%s%s", GetPath(i), filename );
			file = fopen( buf, mode );
			if (file) break;
		}

	return file;
}
예제 #2
0
char *PathList::GetCompletePath( char *filename )
{
	FILE*     file;
	int i;
	char buf[1024];

	/* open the file */
	file = fopen( filename, "r" );
	sprintf(buf,"%s",filename);

	/* if we couldn't find it, search the alternate paths */
	if (!file){
		for (i=0;i<GetNumPaths(); i++)
		{
			sprintf( buf, "%s%s", GetPath(i), filename );
			file = fopen( buf, "r" );
			if (file) break;
		}
	}

	if (!file) return NULL;
	fclose( file );
	return strdup( buf );
}
예제 #3
0
 /// \brief
 ///   Creates a new path and returns a reference to it (same as implicitly adding a new path)
 ///
 /// \return
 ///   Reference to newly added path
 inline VGPath&               CreatePath()                            { m_paths.Add(new VGPath()); return GetPath(GetNumPaths()-1); }