diff --git a/Contrib/Language files/English.nlf b/Contrib/Language files/English.nlf index 69a5869b..ba7178fd 100644 --- a/Contrib/Language files/English.nlf +++ b/Contrib/Language files/English.nlf @@ -1,5 +1,5 @@ # Header, don't edit -NLF v4 +NLF v5 # Start editing here # Language ID 1033 @@ -42,6 +42,7 @@ Space available: Space required: Uninstalling from: Error opening file for writing: \r\n\t"$0"\r\nHit abort to abort installation,\r\nretry to retry writing the file, or\r\nignore to skip this file +Error opening file for writing: \r\n\t"$0"\r\nHit retry to retry writing the file, or\r\ncancel to abort installation Can't write: Copy failed Copy to diff --git a/Source/build.cpp b/Source/build.cpp index 31c4752e..2dd151b5 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -231,6 +231,9 @@ CEXEBuild::CEXEBuild() // init public data. build_packname[0]=build_packcmd[0]=build_output_filename[0]=0; + // Added by ramon 23 May 2003 + build_allowskipfiles=1; + build_overwrite=0; build_compress=1; build_crcchk=1; diff --git a/Source/build.h b/Source/build.h index eeef965d..088f887d 100644 --- a/Source/build.h +++ b/Source/build.h @@ -187,7 +187,8 @@ class CEXEBuild { char build_packname[1024], build_packcmd[1024]; int build_overwrite, build_compress, build_crcchk, - build_datesave, build_optimize_datablock; + build_datesave, build_optimize_datablock, + build_allowskipfiles; // Added by ramon 23 May 2003 header build_header; int uninstall_mode; diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index 1a4a94a3..0a483f61 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -148,7 +148,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) // Saves 8 bytes // HWND mainHwnd = g_hwnd; // #define g_hwnd mainHwnd - + HWND hwSectionHack = g_SectionHack; parms = entry_->offsets; @@ -379,7 +379,8 @@ static int NSISCALL ExecuteEntry(entry *entry_) char *buf3=process_string_fromparm_tobuf(0x31); #define overwriteflag parm0 - log_printf3("File: overwriteflag=%d, name=\"%s\"",overwriteflag,buf3); + // Modified by ramon 23 May 2003 + log_printf4("File: overwriteflag=%d, allowskipfilesflag=%d, name=\"%s\"",overwriteflag,allowskipfilesflag,buf3); if (validpathspec(buf3)) { mystrcpy(buf0,buf3); @@ -416,10 +417,11 @@ static int NSISCALL ExecuteEntry(entry *entry_) mystrcpy(buf2,g_usrvars[0]);//save $0 mystrcpy(g_usrvars[0],buf0); - process_string_fromtab(buf1,LANG_FILEERR); + process_string_fromtab(buf1,parm5&MB_ABORTRETRYIGNORE?LANG_FILEERR:LANG_FILEERR_NOIGNORE); mystrcpy(g_usrvars[0],buf2); // restore $0 - switch (my_MessageBox(buf1,MB_ABORTRETRYIGNORE|MB_ICONSTOP)) + // Modified by ramon 23 May 2003 + switch (my_MessageBox(buf1, parm5)) { case IDRETRY: log_printf("File: error, user retry"); @@ -461,6 +463,8 @@ static int NSISCALL ExecuteEntry(entry *entry_) } #undef overwriteflag + // Added by ramon 23 May 2003 + #undef allowskipfilesflag } break; #endif//NSIS_SUPPORT_FILE @@ -1535,7 +1539,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) } } else g_flags.exec_error++; - } + } break; case EW_INSTTYPESET: { diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index df9179db..c1a6cc71 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -56,7 +56,7 @@ enum EW_GETTEMPFILENAME, // GetTempFileName: 1 [output] #endif #ifdef NSIS_SUPPORT_FILE - EW_EXTRACTFILE, // File to extract: 5,[overwriteflag, output filename, compressed filedata, filedatetimelow, filedatetimehigh] + EW_EXTRACTFILE, // File to extract: 6 [overwriteflag, output filename, compressed filedata, filedatetimelow, filedatetimehigh, allow ignore] // overwriteflag: 0x1 = no. 0x0=force, 0x2=try, 0x3=if date is newer #endif #ifdef NSIS_SUPPORT_DELETE @@ -238,6 +238,7 @@ typedef struct #ifdef NSIS_SUPPORT_FILE int fileerrtext; + int fileerrtext_noignore; #endif #if defined(NSIS_SUPPORT_DELETE) || defined(NSIS_SUPPORT_RMDIR) || defined(NSIS_SUPPORT_FILE) diff --git a/Source/exehead/lang.h b/Source/exehead/lang.h index 9f8504e8..fd7e4c64 100644 --- a/Source/exehead/lang.h +++ b/Source/exehead/lang.h @@ -91,6 +91,7 @@ // instruction strings #define LANG_FILEERR (COMMON_STR(fileerrtext)) +#define LANG_FILEERR_NOIGNORE (COMMON_STR(fileerrtext_noignore)) #define LANG_DELETEFILE (COMMON_STR(del_file)) #define LANG_DLLREGERROR (COMMON_STR(err_reg_dll)) #define LANG_REMOVEDIR (COMMON_STR(remove_dir)) diff --git a/Source/lang.cpp b/Source/lang.cpp index a5f7db5f..f687c610 100644 --- a/Source/lang.cpp +++ b/Source/lang.cpp @@ -43,6 +43,7 @@ char *english_strings[] = { "Space required: ", "Uninstalling from:", "Error opening file for writing: \r\n\t\"$0\"\r\nHit abort to abort installation,\r\nretry to retry writing the file, or\r\nignore to skip this file", + "Error opening file for writing: \r\n\t\"$0\"\r\nHit retry to retry writing the file, or\r\ncancel to abort installation", "Can't write: ", "Copy failed", "Copy to ", @@ -183,6 +184,7 @@ int CEXEBuild::SetString(char *string, int id, int process, StringTable *table) #ifdef NSIS_SUPPORT_FILE HANDLE_STRING_C(NLF_FILE_ERROR, common.fileerrtext); + HANDLE_STRING_C(NLF_FILE_ERROR_NOIGNORE, common.fileerrtext_noignore); #endif default: @@ -540,9 +542,16 @@ void CEXEBuild::FillStringTable(StringTable *table, NLF *nlf/*=0*/) { #endif #ifdef NSIS_SUPPORT_FILE - if (m_inst_fileused && !table->common.fileerrtext) + if (m_inst_fileused) { - table->common.fileerrtext=add_string_main(str(NLF_FILE_ERROR)); + if (!table->common.fileerrtext) + { + table->common.fileerrtext=add_string_main(str(NLF_FILE_ERROR)); + } + if (!table->common.fileerrtext_noignore) + { + table->common.fileerrtext_noignore=add_string_main(str(NLF_FILE_ERROR_NOIGNORE)); + } } #endif @@ -579,9 +588,16 @@ void CEXEBuild::FillStringTable(StringTable *table, NLF *nlf/*=0*/) { } #ifdef NSIS_SUPPORT_FILE - if (m_uninst_fileused && !table->ucommon.fileerrtext) + if (m_uninst_fileused) { - table->ucommon.fileerrtext=add_string_uninst(build_strlist.get() + table->common.fileerrtext); + if (!table->ucommon.fileerrtext) + { + table->ucommon.fileerrtext=add_string_uninst(build_strlist.get() + table->common.fileerrtext); + } + if (!table->ucommon.fileerrtext_noignore) + { + table->ucommon.fileerrtext_noignore=add_string_uninst(build_strlist.get() + table->common.fileerrtext_noignore); + } } #endif @@ -726,7 +742,7 @@ NLF::NLF(char *filename) { if (strncmp(buf, "NLF v", 5)) throw runtime_error("Invalid language file!"); int nlf_version = atoi(buf+5); if (nlf_version != NLF_VERSION) { - if (nlf_version != 2 && nlf_version != 3) + if (nlf_version != 2 && nlf_version != 3 && nlf_version != 4) throw runtime_error("Language file version doesn't match NSIS version!"); } @@ -793,6 +809,14 @@ NLF::NLF(char *filename) { } } + if (nlf_version < 5) { + if (i == NLF_FILE_ERROR_NOIGNORE) { + m_szStrings[i] = new char[strlen(english_strings[i]) + 1]; + strcpy(m_szStrings[i], english_strings[i]); + continue; + } + } + buf[0] = SkipComments(f); fgets(buf+1, NSIS_MAX_STRLEN, f); diff --git a/Source/lang.h b/Source/lang.h index 4d5e9910..57bc85ed 100644 --- a/Source/lang.h +++ b/Source/lang.h @@ -80,7 +80,7 @@ struct StringTable { NLF *nlf; }; -#define NLF_VERSION 4 +#define NLF_VERSION 5 enum { NLF_BRANDING, @@ -116,6 +116,7 @@ enum { NLF_SPACE_REQ, NLF_UNINST_SUBTEXT, NLF_FILE_ERROR, + NLF_FILE_ERROR_NOIGNORE, NLF_CANT_WRITE, NLF_COPY_FAILED, NLF_COPY_TO, diff --git a/Source/script.cpp b/Source/script.cpp index fea23cd2..4ba4d6b5 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -1218,10 +1218,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char } else { - int v=strtoul(p,&p,16); - build_header.license_bg=((v&0xff)<<16)|(v&0xff00)|((v&0xff0000)>>16); - SCRIPT_MSG("LicenseBkColor: %06X\n",v); - } + int v=strtoul(p,&p,16); + build_header.license_bg=((v&0xff)<<16)|(v&0xff00)|((v&0xff0000)>>16); + SCRIPT_MSG("LicenseBkColor: %06X\n",v); + } } return make_sure_not_in_secorfunc(line.gettoken_str(0)); #else//!NSIS_CONFIG_LICENSEPAGE @@ -2317,6 +2317,13 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char // flag setters /////////////////////////////////////////////////////////////////////////////// + // BEGIN - Added by ramon 23 May 2003 + case TOK_ALLOWSKIPFILES: + build_allowskipfiles=line.gettoken_enum(1,"off\0on\0"); + if (build_allowskipfiles==-1) PRINTHELP() + SCRIPT_MSG("AllowSkipFiles: %s\n",line.gettoken_str(1)); + return PS_OK; + // END - Added by ramon 23 May 2003 case TOK_SETDATESAVE: build_datesave=line.gettoken_enum(1,"off\0on\0"); if (build_datesave==-1) PRINTHELP() @@ -2376,9 +2383,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char int a = 1; WORD lang = 0; if (!strnicmp(line.gettoken_str(a),"/LANG=",6)) lang=atoi(line.gettoken_str(a++)+6); - if (line.getnumtokens()!=a+1) PRINTHELP(); SetString(line.gettoken_str(a),NLF_FILE_ERROR,1,lang); - SCRIPT_MSG("FileErrorText: \"%s\"\n",line.gettoken_str(a)); + SetString(line.gettoken_str(a+1),NLF_FILE_ERROR_NOIGNORE,1,lang); + SCRIPT_MSG("FileErrorText: \"%s\" \"%s\"\n",line.gettoken_str(a),line.gettoken_str(a+1)); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); #else @@ -4366,6 +4373,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (data_handle == -1) { int files_added; + // BEGIN - Added by ramon 23 May 2003 + int old_build_allowskipfiles=build_allowskipfiles; + build_allowskipfiles=1; // on + // END - Added by ramon 23 May 2003 int old_build_overwrite=build_overwrite; build_overwrite=1; // off int old_build_datesave=build_datesave; @@ -4378,6 +4389,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char m_plugins.SetDllDataHandle(uninstall_mode, line.gettoken_str(0),data_handle); build_overwrite=old_build_overwrite; build_datesave=old_build_datesave; + // Added by ramon 23 May 2003 + build_allowskipfiles=old_build_allowskipfiles; } else { @@ -4385,6 +4398,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char ent.offsets[0]=1; // overwrite off ent.offsets[1]=add_string(tempDLL); ent.offsets[2]=data_handle; + ent.offsets[3]=0xffffffff; + ent.offsets[4]=0xffffffff; + ent.offsets[5]=MB_ABORTRETRYIGNORE | MB_ICONSTOP; ret=add_entry(&ent); if (ret != PS_OK) { free(command); @@ -4622,6 +4638,9 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn ent.offsets[3]=0xffffffff; ent.offsets[4]=0xffffffff; } + // Added by ramon 23 May 2003 + ent.offsets[5]=(build_allowskipfiles?MB_ABORTRETRYIGNORE:MB_RETRYCANCEL) | MB_ICONSTOP; + if (uninstall_mode) m_uninst_fileused++; else m_inst_fileused++; } diff --git a/Source/tokens.cpp b/Source/tokens.cpp index f615a6a8..581961af 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -65,7 +65,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_FLUSHINI,"FlushINI",1,0,"ini_file"}, {TOK_RESERVEFILE,"ReserveFile",1,-1,"[/nonfatal] [/r] file [file...]"}, {TOK_FILECLOSE,"FileClose",1,0,"$(user_var: handle input)"}, -{TOK_FILEERRORTEXT,"FileErrorText",0,2,"[/LANG=lang_id] [text (can contain $0)]"}, +{TOK_FILEERRORTEXT,"FileErrorText",0,3,"[/LANG=lang_id] [text (can contain $0)] [text without ignore (can contain $0)]"}, {TOK_FILEOPEN,"FileOpen",3,0,"$(user_var: handle output) filename openmode\n openmode=r|w|a"}, {TOK_FILEREAD,"FileRead",2,1,"$(user_var: handle input) $(user_var: text output) [maxlen]"}, {TOK_FILEWRITE,"FileWrite",2,0,"$(user_var: handle input) text"}, @@ -224,7 +224,9 @@ static tokenType tokenlist[TOK__LAST] = {TOK_GETCURRENTADDR,"GetCurrentAddress",1,0,"output"}, {TOK_PLUGINDIR,"!AddPluginDir",1,0,"new_plugin_directory"}, -{TOK_INITPLUGINSDIR,"InitPluginsDir",0,0,""} +{TOK_INITPLUGINSDIR,"InitPluginsDir",0,0,""}, +// Added by ramon 23 May 2003 +{TOK_ALLOWSKIPFILES,"AllowSkipFiles",1,0,"(off|on)"} }; void CEXEBuild::print_help(char *commandname) diff --git a/Source/tokens.h b/Source/tokens.h index 8b4512fe..58827172 100644 --- a/Source/tokens.h +++ b/Source/tokens.h @@ -212,9 +212,11 @@ enum TOK_INITPLUGINSDIR, TOK_CREATEFONT, TOK_SHOWWINDOW, + // Added by ramon 23 May 2003 + TOK_ALLOWSKIPFILES, TOK__LAST, TOK__PLUGINCOMMAND }; -#endif//_TOKENS_H_ \ No newline at end of file +#endif//_TOKENS_H_