1.1 --- a/sourcepawn/compiler/sc1.c Mon Jan 29 05:02:44 2007 +0000
1.2 +++ b/sourcepawn/compiler/sc1.c Mon Jan 29 06:43:27 2007 +0000
1.3 @@ -170,6 +170,8 @@
1.4 static HWND hwndFinish = 0;
1.5 #endif
1.6
1.7 +char g_tmpfile[_MAX_PATH] = {0};
1.8 +
1.9 /* "main" of the compiler
1.10 */
1.11 #if defined __cplusplus
1.12 @@ -263,20 +265,22 @@
1.13 unsigned char tstring[128];
1.14 fsrc=(FILE*)pc_opensrc(sname);
1.15 if (fsrc==NULL) {
1.16 + pc_closesrc(ftmp);
1.17 + remove(tname);
1.18 strcpy(inpfname,sname); /* avoid invalid filename */
1.19 error(100,sname);
1.20 } /* if */
1.21 - pc_writesrc(ftmp,(unsigned char*)"#file ");
1.22 + pc_writesrc(ftmp,(unsigned char*)"#file \"");
1.23 pc_writesrc(ftmp,(unsigned char*)sname);
1.24 - pc_writesrc(ftmp,(unsigned char*)"\n");
1.25 - while (!pc_eofsrc(fsrc)) {
1.26 - pc_readsrc(fsrc,tstring,sizeof tstring);
1.27 + pc_writesrc(ftmp,(unsigned char*)"\"\n");
1.28 + while (!pc_eofsrc(fsrc) && pc_readsrc(fsrc,tstring,sizeof tstring)) {
1.29 pc_writesrc(ftmp,tstring);
1.30 } /* while */
1.31 pc_closesrc(fsrc);
1.32 } /* for */
1.33 pc_closesrc(ftmp);
1.34 strcpy(inpfname,tname);
1.35 + strcpy(g_tmpfile,tname);
1.36 free(tname);
1.37 } else {
1.38 strcpy(inpfname,get_sourcefile(0));
1.39 @@ -481,9 +485,10 @@
1.40 } /* if */
1.41 #endif
1.42
1.43 + if (g_tmpfile[0] != '\0') {
1.44 + remove(g_tmpfile);
1.45 + }
1.46 if (inpfname!=NULL) {
1.47 - if (get_sourcefile(1)!=NULL)
1.48 - remove(inpfname); /* the "input file" was in fact a temporary file */
1.49 free(inpfname);
1.50 } /* if */
1.51 if (litq!=NULL)