Try to open source file in current directory first in case it is a

generated file.
This commit is contained in:
Alexandre Julliard 2002-12-11 01:30:14 +00:00
parent bc8b8a2221
commit 184c40a397
1 changed files with 10 additions and 4 deletions

View File

@ -189,18 +189,24 @@ static FILE *open_src_file( INCL_FILE *pFile )
{
FILE *file;
/* first try name as is */
if ((file = fopen( pFile->name, "r" )))
{
pFile->filename = xstrdup( pFile->name );
return file;
}
/* now try in source dir */
if (SrcDir)
{
pFile->filename = xmalloc( strlen(SrcDir) + strlen(pFile->name) + 2 );
strcpy( pFile->filename, SrcDir );
strcat( pFile->filename, "/" );
strcat( pFile->filename, pFile->name );
file = fopen( pFile->filename, "r" );
}
else pFile->filename = xstrdup( pFile->name );
if (!(file = fopen( pFile->filename, "r" )))
if (!file)
{
perror( pFile->filename );
perror( pFile->name );
exit(1);
}
return file;