Moved __DATE__ and __TIME__ predefines into CEXEBuild::process_script
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2736 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
3631b42514
commit
4661dd7069
3 changed files with 33 additions and 31 deletions
|
@ -111,6 +111,8 @@ class CEXEBuild {
|
|||
void restore_timestamp_predefine(char *);
|
||||
char* set_line_predefine(int, BOOL);
|
||||
void restore_line_predefine(char *);
|
||||
void set_date_time_predefines();
|
||||
void del_date_time_predefines();
|
||||
#endif
|
||||
int parseScript();
|
||||
#ifdef NSIS_FIX_DEFINES_IN_STRINGS
|
||||
|
|
|
@ -340,38 +340,7 @@ int main(int argc, char **argv)
|
|||
fprintf(g_output,"\n\nProcessing script file: \"%s\"\n",sfile);
|
||||
fflush(g_output);
|
||||
}
|
||||
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
|
||||
// Added by Sunil Kamath 23 June 2003
|
||||
{
|
||||
time_t etime;
|
||||
struct tm * ltime;
|
||||
SYSTEMTIME stime;
|
||||
char datebuf[32];
|
||||
char timebuf[32];
|
||||
|
||||
time(&etime);
|
||||
ltime = localtime(&etime);
|
||||
stime.wYear = ltime->tm_year+1900;
|
||||
stime.wMonth = ltime->tm_mon + 1;
|
||||
stime.wDay = ltime->tm_mday;
|
||||
stime.wHour= ltime->tm_hour;
|
||||
stime.wMinute= ltime->tm_min;
|
||||
stime.wSecond= ltime->tm_sec;
|
||||
stime.wMilliseconds= 0;
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &stime, NULL, datebuf, sizeof(datebuf));
|
||||
build.definedlist.add("__DATE__",(char *)datebuf);
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stime, NULL, timebuf, sizeof(timebuf));
|
||||
build.definedlist.add("__TIME__",(char *)timebuf);
|
||||
}
|
||||
#endif
|
||||
int ret=build.process_script(fp,sfile);
|
||||
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
|
||||
// Added by Sunil Kamath 23 June 2003
|
||||
{
|
||||
build.definedlist.del("__DATE__");
|
||||
build.definedlist.del("__TIME__");
|
||||
}
|
||||
#endif
|
||||
if (fp != stdin) fclose(fp);
|
||||
|
||||
if (ret != PS_EOF && ret != PS_OK)
|
||||
|
|
|
@ -124,6 +124,35 @@ void CEXEBuild::restore_line_predefine(char *oldline)
|
|||
free(oldline);
|
||||
}
|
||||
}
|
||||
|
||||
void CEXEBuild::set_date_time_predefines()
|
||||
{
|
||||
time_t etime;
|
||||
struct tm * ltime;
|
||||
SYSTEMTIME stime;
|
||||
char datebuf[32];
|
||||
char timebuf[32];
|
||||
|
||||
time(&etime);
|
||||
ltime = localtime(&etime);
|
||||
stime.wYear = ltime->tm_year+1900;
|
||||
stime.wMonth = ltime->tm_mon + 1;
|
||||
stime.wDay = ltime->tm_mday;
|
||||
stime.wHour= ltime->tm_hour;
|
||||
stime.wMinute= ltime->tm_min;
|
||||
stime.wSecond= ltime->tm_sec;
|
||||
stime.wMilliseconds= 0;
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &stime, NULL, datebuf, sizeof(datebuf));
|
||||
definedlist.add("__DATE__",(char *)datebuf);
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stime, NULL, timebuf, sizeof(timebuf));
|
||||
definedlist.add("__TIME__",(char *)timebuf);
|
||||
}
|
||||
|
||||
void CEXEBuild::del_date_time_predefines()
|
||||
{
|
||||
definedlist.del("__DATE__");
|
||||
definedlist.del("__TIME__");
|
||||
}
|
||||
#endif
|
||||
|
||||
int CEXEBuild::process_script(FILE *filepointer, char *filename)
|
||||
|
@ -140,6 +169,7 @@ int CEXEBuild::process_script(FILE *filepointer, char *filename)
|
|||
|
||||
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
|
||||
// Added by Sunil Kamath 11 June 2003
|
||||
set_date_time_predefines();
|
||||
char *oldfilename = set_file_predefine(curfilename);
|
||||
char *oldtimestamp = set_timestamp_predefine(curfilename);
|
||||
#endif
|
||||
|
@ -150,6 +180,7 @@ int CEXEBuild::process_script(FILE *filepointer, char *filename)
|
|||
// Added by Sunil Kamath 11 June 2003
|
||||
restore_file_predefine(oldfilename);
|
||||
restore_timestamp_predefine(oldtimestamp);
|
||||
del_date_time_predefines();
|
||||
#endif
|
||||
|
||||
fp = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue