# HG changeset patch # User David Anderson # Date 1170053007 0 # Node ID f53fa73d895a32fa8c3ec70d6d8fe70db00fc0d3 # Parent 3e5727a37caa434a8440aca27f4826db5c2146fe multiple input files feature now works again diff -r 3e5727a37caa -r f53fa73d895a sourcepawn/compiler/sc1.c --- a/sourcepawn/compiler/sc1.c Mon Jan 29 05:02:44 2007 +0000 +++ b/sourcepawn/compiler/sc1.c Mon Jan 29 06:43:27 2007 +0000 @@ -170,6 +170,8 @@ static HWND hwndFinish = 0; #endif +char g_tmpfile[_MAX_PATH] = {0}; + /* "main" of the compiler */ #if defined __cplusplus @@ -263,20 +265,22 @@ unsigned char tstring[128]; fsrc=(FILE*)pc_opensrc(sname); if (fsrc==NULL) { + pc_closesrc(ftmp); + remove(tname); strcpy(inpfname,sname); /* avoid invalid filename */ error(100,sname); } /* if */ - pc_writesrc(ftmp,(unsigned char*)"#file "); + pc_writesrc(ftmp,(unsigned char*)"#file \""); pc_writesrc(ftmp,(unsigned char*)sname); - pc_writesrc(ftmp,(unsigned char*)"\n"); - while (!pc_eofsrc(fsrc)) { - pc_readsrc(fsrc,tstring,sizeof tstring); + pc_writesrc(ftmp,(unsigned char*)"\"\n"); + while (!pc_eofsrc(fsrc) && pc_readsrc(fsrc,tstring,sizeof tstring)) { pc_writesrc(ftmp,tstring); } /* while */ pc_closesrc(fsrc); } /* for */ pc_closesrc(ftmp); strcpy(inpfname,tname); + strcpy(g_tmpfile,tname); free(tname); } else { strcpy(inpfname,get_sourcefile(0)); @@ -481,9 +485,10 @@ } /* if */ #endif + if (g_tmpfile[0] != '\0') { + remove(g_tmpfile); + } if (inpfname!=NULL) { - if (get_sourcefile(1)!=NULL) - remove(inpfname); /* the "input file" was in fact a temporary file */ free(inpfname); } /* if */ if (litq!=NULL)