diff --git a/cck/ib/ib.cpp b/cck/ib/ib.cpp index 7c4007421e2..0580b1953cc 100644 --- a/cck/ib/ib.cpp +++ b/cck/ib/ib.cpp @@ -32,6 +32,8 @@ WIDGET *tempWidget; char buffer[50000]; XPI xpiList[100]; int xpiLen = -1; +JAR jarList[100]; +int jarLen = -1; // Setup Sections for config.ini CString Setup0Short = "&Typical"; CString Setup1Short = "C&ustom"; @@ -64,7 +66,7 @@ int findXPI(CString xpiname, CString filename) int ExtractXPIFile(CString xpiname, CString xpifile) { CString command; - +// AfxMessageBox("The xpiname is "+xpiname+" and the file is "+xpifile,MB_OK); if (findXPI(xpiname, xpifile)) return TRUE; @@ -99,6 +101,65 @@ int ReplaceXPIFiles() return TRUE; } +int findJAR(CString jarname, CString filename) +{ + int found = FALSE; + + for (int i=0; !found && i<=jarLen; i++) + if (jarList[i].jarname == jarname && + jarList[i].filename == filename) + found = TRUE; + + if (!found) + { + jarLen++; + jarList[jarLen].jarname = jarname; + jarList[jarLen].filename = filename; + } + + return found; +} + +int ExtractJARFile(CString xpiname, CString jarname, CString xpifile) +{ +// AfxMessageBox("The xpiname is "+xpiname+" and the jar name is "+jarname+" and the file is "+xpifile,MB_OK); + + ExtractXPIFile(xpiname, jarname); + + CString command; +//We have to get rid of the bin/chrome/ and hence the delete. + jarname.Delete(0,11); + + if (findJAR(jarname, xpifile)) + return TRUE; + + // Can use -d instead of change CWD??? + CString jarArchive = tempPath + "\\bin\\chrome\\" + jarname; + command = quotes +rootPath + "unzip.exe"+ quotes + "-o" + spaces + quotes + jarArchive + quotes + spaces + quotes + xpifile + quotes; + ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE); + + return TRUE; +} + +int ReplaceJARFiles() +{ + CString command; + CString jarArchive; + + // Go through the whole list putting them into the archives + for (int i=0; i<=jarLen; i++) + { + // This copy preserves the existing archive if it exists - do we + // need to delete it the first time through? + jarArchive = tempPath + "\\bin\\chrome\\" + jarList[i].jarname; + + command = quotes + rootPath + "zip.exe" + quotes + "-m " + spaces + quotes +jarArchive + quotes + spaces + quotes + jarList[i].filename + quotes; + ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE); + } + + return TRUE; +} + int ReplaceINIFile() { CString command1,command2; @@ -384,9 +445,11 @@ int interpret(char *cmd) else if (strcmp(cmdname, "replaceXPI") == 0) { char *xpiname = strtok(NULL, ",)"); + char *jname = strtok(NULL, ",)"); char *xpifile = strtok(NULL, ",)"); char *value = strtok(NULL, ",)"); char *newvalue = value; + CString jarname = jname; if (value[0] == '%') { value++; @@ -406,7 +469,12 @@ int interpret(char *cmd) if (filename.IsEmpty()) return TRUE; //////////////////////////////// + //check to see if it is a jar and then do accordingly + if (jarname.CompareNoCase("no.jar")==0) ExtractXPIFile(xpiname, xpifile); + else + ExtractJARFile(xpiname, jarname, xpifile); + if (!CopyFile(newvalue, xpifile, FALSE)) { DWORD e = GetLastError(); @@ -418,10 +486,13 @@ int interpret(char *cmd) (strcmp(cmdname, "modifyProperties") == 0)) { char *xpiname = strtok(NULL, ",)"); + char *jname = strtok(NULL, ",)"); char *xpifile = strtok(NULL, ",)"); char *entity = strtok(NULL, ",)"); char *value = strtok(NULL, ",)"); char *newvalue = value; + CString jarname = jname; + if (value[0] == '%') { value++; @@ -433,7 +504,12 @@ int interpret(char *cmd) } if (!xpiname || !xpifile || !entity || !newvalue) return TRUE;//*** Changed FALSE to TRUE + //check to see if it is a jar and then do accordingly + if (jarname.CompareNoCase("no.jar")==0) ExtractXPIFile(xpiname, xpifile); + else + ExtractJARFile(xpiname, jarname, xpifile); + if(strcmp(cmdname, "modifyJS") == 0) ModifyJS(xpifile,entity,newvalue); else if (strcmp(cmdname, "modifyProperties") == 0) @@ -868,6 +944,8 @@ int StartIB(CString parms, WIDGET *curWidget) dlg->SetWindowText(" Customization is in Progress \n |||||||||"); // Put all the extracted files back into their new XPI homes + ReplaceJARFiles(); + ReplaceXPIFiles(); dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||"); diff --git a/cck/ib/ib.h b/cck/ib/ib.h index 47578fe05ed..d2e0607e79b 100644 --- a/cck/ib/ib.h +++ b/cck/ib/ib.h @@ -2,6 +2,11 @@ typedef struct s_xpi { CString xpiname; CString filename; } XPI; +typedef struct s_jar { + CString jarname; + CString filename; + } JAR; + void CreateRshell(void); void CreateHelpMenu(void); void CreateBuddyList(void); \ No newline at end of file diff --git a/cck/ib/script.ib b/cck/ib/script.ib index ea5c4a188f4..16b31aba517 100644 --- a/cck/ib/script.ib +++ b/cck/ib/script.ib @@ -3,14 +3,14 @@ configure(GENERAL,Setup Title1,%InstallerScreenText1%) configure(GENERAL,Setup Title2,%InstallerScreenText2%) configure(GENERAL,Program Folder Name,%ProgramFolderName%) configure(Dialog Setup Type,Readme Filename,%ReadMeFile%) -replaceXPI(browser.xpi,bin/chrome/packages/widget-toolkit/global/content/helpMenu.xul,%HlpXul%) -replaceXPI(browser.xpi,bin/chrome/skins/classic/global/skin/animthrob.gif,%LargeAnimPath%) -replaceXPI(browser.xpi,bin/chrome/skins/classic/global/skin/animthrob_single.gif,%LargeStillPath%) -replaceXPI(browser.xpi,bin/chrome/skins/modern/global/skin/animthrob.gif,%LargeAnimPath%) -replaceXPI(browser.xpi,bin/chrome/skins/modern/global/skin/animthrob_single.gif,%LargeStillPath%) -replaceXPI(deflenus.xpi,bin/defaults/profile/bookmarks.html,%CustomBookmarkFile%) -replaceXPI(deflenus.xpi,bin/defaults/profile/panels.rdf,%SidebarPath%) -modifyDTD(langenus.xpi,bin/chrome/locales/en-US/navigator/locale/navigator.dtd,mainWindow.titlemodifier,%CompanyName%) -modifyProperties(langenus.xpi,bin/chrome/locales/en-US/navigator/locale/navigator.properties,browser.startup.homepage,%HomePageURL%) -modifyProperties(langenus.xpi,bin/chrome/locales/en-US/navigator/locale/navigator.properties,browser.throbber.url,%AnimatedLogoURL%) -modifyJS(browser.xpi,bin/defaults/pref/all-ns.js,general.useragent.vendorComment,%OrganizationName%) +replaceXPI(browser.xpi,no.jar,bin/chrome/packages/widget-toolkit/global/content/helpMenu.xul,%HlpXul%) +replaceXPI(browser.xpi,bin/chrome/classic.jar,skin/classic/global/animthrob.gif,%LargeAnimPath%) +replaceXPI(browser.xpi,bin/chrome/classic.jar,skin/classic/global/animthrob_single.gif,%LargeStillPath%) +replaceXPI(browser.xpi,bin/chrome/modern.jar,skin/modern/global/animthrob.gif,%LargeAnimPath%) +replaceXPI(browser.xpi,bin/chrome/modern.jar,skin/modern/global/animthrob_single.gif,%LargeStillPath%) +replaceXPI(deflenus.xpi,no.jar,bin/defaults/profile/bookmarks.html,%CustomBookmarkFile%) +replaceXPI(deflenus.xpi,no.jar,bin/defaults/profile/panels.rdf,%SidebarPath%) +modifyDTD(langenus.xpi,bin/chrome/en-US.jar,locale/en-US/navigator/navigator.dtd,mainWindow.titlemodifier,%CompanyName%) +modifyProperties(langenus.xpi,bin/chrome/en-US.jar,locale/en-US/navigator/navigator.properties,browser.startup.homepage,%HomePageURL%) +modifyProperties(langenus.xpi,bin/chrome/en-US.jar,locale/en-US/navigator/navigator.properties,browser.throbber.url,%AnimatedLogoURL%) +modifyJS(browser.xpi,no.jar,bin/defaults/pref/all-ns.js,general.useragent.vendorComment,%OrganizationName%)