changing ib.cpp because of jar changes

This commit is contained in:
varada%netscape.com 2000-09-27 01:42:51 +00:00
Родитель af421ce118
Коммит 7ae643910b
3 изменённых файлов: 95 добавлений и 12 удалений

Просмотреть файл

@ -32,6 +32,8 @@ WIDGET *tempWidget;
char buffer[50000]; char buffer[50000];
XPI xpiList[100]; XPI xpiList[100];
int xpiLen = -1; int xpiLen = -1;
JAR jarList[100];
int jarLen = -1;
// Setup Sections for config.ini // Setup Sections for config.ini
CString Setup0Short = "&Typical"; CString Setup0Short = "&Typical";
CString Setup1Short = "C&ustom"; CString Setup1Short = "C&ustom";
@ -64,7 +66,7 @@ int findXPI(CString xpiname, CString filename)
int ExtractXPIFile(CString xpiname, CString xpifile) int ExtractXPIFile(CString xpiname, CString xpifile)
{ {
CString command; CString command;
// AfxMessageBox("The xpiname is "+xpiname+" and the file is "+xpifile,MB_OK);
if (findXPI(xpiname, xpifile)) if (findXPI(xpiname, xpifile))
return TRUE; return TRUE;
@ -99,6 +101,65 @@ int ReplaceXPIFiles()
return TRUE; 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() int ReplaceINIFile()
{ {
CString command1,command2; CString command1,command2;
@ -384,9 +445,11 @@ int interpret(char *cmd)
else if (strcmp(cmdname, "replaceXPI") == 0) else if (strcmp(cmdname, "replaceXPI") == 0)
{ {
char *xpiname = strtok(NULL, ",)"); char *xpiname = strtok(NULL, ",)");
char *jname = strtok(NULL, ",)");
char *xpifile = strtok(NULL, ",)"); char *xpifile = strtok(NULL, ",)");
char *value = strtok(NULL, ",)"); char *value = strtok(NULL, ",)");
char *newvalue = value; char *newvalue = value;
CString jarname = jname;
if (value[0] == '%') if (value[0] == '%')
{ {
value++; value++;
@ -406,7 +469,12 @@ int interpret(char *cmd)
if (filename.IsEmpty()) if (filename.IsEmpty())
return TRUE; return TRUE;
//////////////////////////////// ////////////////////////////////
//check to see if it is a jar and then do accordingly
if (jarname.CompareNoCase("no.jar")==0)
ExtractXPIFile(xpiname, xpifile); ExtractXPIFile(xpiname, xpifile);
else
ExtractJARFile(xpiname, jarname, xpifile);
if (!CopyFile(newvalue, xpifile, FALSE)) if (!CopyFile(newvalue, xpifile, FALSE))
{ {
DWORD e = GetLastError(); DWORD e = GetLastError();
@ -418,10 +486,13 @@ int interpret(char *cmd)
(strcmp(cmdname, "modifyProperties") == 0)) (strcmp(cmdname, "modifyProperties") == 0))
{ {
char *xpiname = strtok(NULL, ",)"); char *xpiname = strtok(NULL, ",)");
char *jname = strtok(NULL, ",)");
char *xpifile = strtok(NULL, ",)"); char *xpifile = strtok(NULL, ",)");
char *entity = strtok(NULL, ",)"); char *entity = strtok(NULL, ",)");
char *value = strtok(NULL, ",)"); char *value = strtok(NULL, ",)");
char *newvalue = value; char *newvalue = value;
CString jarname = jname;
if (value[0] == '%') if (value[0] == '%')
{ {
value++; value++;
@ -433,7 +504,12 @@ int interpret(char *cmd)
} }
if (!xpiname || !xpifile || !entity || !newvalue) if (!xpiname || !xpifile || !entity || !newvalue)
return TRUE;//*** Changed FALSE to TRUE 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); ExtractXPIFile(xpiname, xpifile);
else
ExtractJARFile(xpiname, jarname, xpifile);
if(strcmp(cmdname, "modifyJS") == 0) if(strcmp(cmdname, "modifyJS") == 0)
ModifyJS(xpifile,entity,newvalue); ModifyJS(xpifile,entity,newvalue);
else if (strcmp(cmdname, "modifyProperties") == 0) else if (strcmp(cmdname, "modifyProperties") == 0)
@ -868,6 +944,8 @@ int StartIB(CString parms, WIDGET *curWidget)
dlg->SetWindowText(" Customization is in Progress \n |||||||||"); dlg->SetWindowText(" Customization is in Progress \n |||||||||");
// Put all the extracted files back into their new XPI homes // Put all the extracted files back into their new XPI homes
ReplaceJARFiles();
ReplaceXPIFiles(); ReplaceXPIFiles();
dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||"); dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||");

Просмотреть файл

@ -2,6 +2,11 @@ typedef struct s_xpi {
CString xpiname; CString xpiname;
CString filename; CString filename;
} XPI; } XPI;
typedef struct s_jar {
CString jarname;
CString filename;
} JAR;
void CreateRshell(void); void CreateRshell(void);
void CreateHelpMenu(void); void CreateHelpMenu(void);
void CreateBuddyList(void); void CreateBuddyList(void);

Просмотреть файл

@ -3,14 +3,14 @@ configure(GENERAL,Setup Title1,%InstallerScreenText1%)
configure(GENERAL,Setup Title2,%InstallerScreenText2%) configure(GENERAL,Setup Title2,%InstallerScreenText2%)
configure(GENERAL,Program Folder Name,%ProgramFolderName%) configure(GENERAL,Program Folder Name,%ProgramFolderName%)
configure(Dialog Setup Type,Readme Filename,%ReadMeFile%) configure(Dialog Setup Type,Readme Filename,%ReadMeFile%)
replaceXPI(browser.xpi,bin/chrome/packages/widget-toolkit/global/content/helpMenu.xul,%HlpXul%) replaceXPI(browser.xpi,no.jar,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/classic.jar,skin/classic/global/animthrob.gif,%LargeAnimPath%)
replaceXPI(browser.xpi,bin/chrome/skins/classic/global/skin/animthrob_single.gif,%LargeStillPath%) replaceXPI(browser.xpi,bin/chrome/classic.jar,skin/classic/global/animthrob_single.gif,%LargeStillPath%)
replaceXPI(browser.xpi,bin/chrome/skins/modern/global/skin/animthrob.gif,%LargeAnimPath%) replaceXPI(browser.xpi,bin/chrome/modern.jar,skin/modern/global/animthrob.gif,%LargeAnimPath%)
replaceXPI(browser.xpi,bin/chrome/skins/modern/global/skin/animthrob_single.gif,%LargeStillPath%) replaceXPI(browser.xpi,bin/chrome/modern.jar,skin/modern/global/animthrob_single.gif,%LargeStillPath%)
replaceXPI(deflenus.xpi,bin/defaults/profile/bookmarks.html,%CustomBookmarkFile%) replaceXPI(deflenus.xpi,no.jar,bin/defaults/profile/bookmarks.html,%CustomBookmarkFile%)
replaceXPI(deflenus.xpi,bin/defaults/profile/panels.rdf,%SidebarPath%) replaceXPI(deflenus.xpi,no.jar,bin/defaults/profile/panels.rdf,%SidebarPath%)
modifyDTD(langenus.xpi,bin/chrome/locales/en-US/navigator/locale/navigator.dtd,mainWindow.titlemodifier,%CompanyName%) modifyDTD(langenus.xpi,bin/chrome/en-US.jar,locale/en-US/navigator/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/en-US.jar,locale/en-US/navigator/navigator.properties,browser.startup.homepage,%HomePageURL%)
modifyProperties(langenus.xpi,bin/chrome/locales/en-US/navigator/locale/navigator.properties,browser.throbber.url,%AnimatedLogoURL%) modifyProperties(langenus.xpi,bin/chrome/en-US.jar,locale/en-US/navigator/navigator.properties,browser.throbber.url,%AnimatedLogoURL%)
modifyJS(browser.xpi,bin/defaults/pref/all-ns.js,general.useragent.vendorComment,%OrganizationName%) modifyJS(browser.xpi,no.jar,bin/defaults/pref/all-ns.js,general.useragent.vendorComment,%OrganizationName%)