Print full file path in error messages

This commit is contained in:
dbrotz
2018-12-06 22:59:24 -08:00
parent e25a4b0abc
commit a05fd9b818
3 changed files with 10 additions and 6 deletions

View File

@@ -234,7 +234,7 @@ void fstk_AddIncludePath(char *s)
fatalerror("Include path too long '%s'", s);
}
FILE *fstk_FindFile(char *fname)
FILE *fstk_FindFile(char *fname, char **incPathUsed)
{
char path[_MAX_PATH];
int32_t i;
@@ -275,6 +275,8 @@ FILE *fstk_FindFile(char *fname)
fprintf(dependfile, "%s: %s\n", tzObjectname,
path);
}
if (incPathUsed)
*incPathUsed = IncludePaths[i];
return f;
}
}
@@ -288,7 +290,8 @@ FILE *fstk_FindFile(char *fname)
*/
void fstk_RunInclude(char *tzFileName)
{
FILE *f = fstk_FindFile(tzFileName);
char *incPathUsed = "";
FILE *f = fstk_FindFile(tzFileName, &incPathUsed);
if (f == NULL)
err(1, "Unable to open included file '%s'", tzFileName);
@@ -296,7 +299,8 @@ void fstk_RunInclude(char *tzFileName)
pushcontext();
nLineNo = 1;
nCurrentStatus = STAT_isInclude;
strcpy(tzCurrentFileName, tzFileName);
snprintf(tzCurrentFileName, sizeof(tzCurrentFileName), "%s%s",
incPathUsed, tzFileName);
pCurrentFile = f;
CurrentFlexHandle = yy_create_buffer(pCurrentFile);
yy_switch_to_buffer(CurrentFlexHandle);