fix for bug#47328 - not able to launch customized netscape;caused by all-ns.js using properties files for the values- changed ib.cpp and script.ib to reflect that

This commit is contained in:
varada%netscape.com 2000-08-04 18:09:21 +00:00
Родитель 0590d1c246
Коммит 4f43da102f
2 изменённых файлов: 47 добавлений и 5 удалений

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

@ -4,6 +4,7 @@
#include "globals.h" #include "globals.h"
#include "comp.h" #include "comp.h"
#include "ib.h" #include "ib.h"
#include "fstream.h"
#include <afxtempl.h> #include <afxtempl.h>
#include <afxdisp.h> #include <afxdisp.h>
#include "resource.h" #include "resource.h"
@ -146,6 +147,44 @@ void ModifyPref(char *buffer, CString entity, CString newvalue)
strcpy(buffer, (char *)(LPCTSTR) buf); strcpy(buffer, (char *)(LPCTSTR) buf);
} }
int ModifyProperties(CString xpifile, CString entity, CString newvalue)
{
int rv = TRUE;
CString propFile = xpifile;
CString tempFile = xpifile + ".temp";
char properties[400];
ofstream tf(tempFile);
if(!tf)
{
rv = FALSE;
cout <<"Cannot open: "<<tempFile<<"\n";
return rv;
}
tf<< entity <<"="<<newvalue <<"\n";
ifstream pf(propFile);
if (!pf)
{
rv = FALSE;
cout <<"Cannot open: "<<propFile<<"\n";
return rv;
}
while (!pf.eof())
{
pf.getline(properties,400);
tf <<properties<<"\n";
}
pf.close();
tf.close();
remove(xpifile);
rename(tempFile, xpifile);
return rv;
}
int ModifyJS(CString xpifile, CString entity, CString newvalue) int ModifyJS(CString xpifile, CString entity, CString newvalue)
{ {
CString newfile = xpifile + ".new"; CString newfile = xpifile + ".new";
@ -318,7 +357,8 @@ int interpret(char *cmd)
} }
} }
else if ((strcmp(cmdname, "modifyDTD") == 0) || else if ((strcmp(cmdname, "modifyDTD") == 0) ||
(strcmp(cmdname, "modifyJS") == 0)) (strcmp(cmdname, "modifyJS") == 0) ||
(strcmp(cmdname, "modifyProperties") == 0))
{ {
char *xpiname = strtok(NULL, ",)"); char *xpiname = strtok(NULL, ",)");
char *xpifile = strtok(NULL, ",)"); char *xpifile = strtok(NULL, ",)");
@ -339,6 +379,8 @@ int interpret(char *cmd)
ExtractXPIFile(xpiname, xpifile); ExtractXPIFile(xpiname, 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)
ModifyProperties(xpifile,entity,newvalue);
else else
ModifyDTD(xpifile, entity, newvalue); ModifyDTD(xpifile, entity, newvalue);
} }

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

@ -8,8 +8,8 @@ replaceXPI(browser.xpi,bin/chrome/skins/classic/global/skin/animthrob.gif,%Large
replaceXPI(browser.xpi,bin/chrome/skins/classic/global/skin/animthrob_single.gif,%LargeStillPath%) 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.gif,%LargeAnimPath%)
replaceXPI(browser.xpi,bin/chrome/skins/modern/global/skin/animthrob_single.gif,%LargeStillPath%) replaceXPI(browser.xpi,bin/chrome/skins/modern/global/skin/animthrob_single.gif,%LargeStillPath%)
replaceXPI(browser.xpi,bin/defaults/profile/bookmarks.html,%CustomBookmarkFile%) replaceXPI(deflenus.xpi,bin/defaults/profile/bookmarks.html,%CustomBookmarkFile%)
replaceXPI(browser.xpi,bin/defaults/profile/panels.rdf,%SidebarPath%) replaceXPI(deflenus.xpi,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/locales/en-US/navigator/locale/navigator.dtd,mainWindow.titlemodifier,%CompanyName%)
modifyJS(browser.xpi,bin/defaults/pref/all-ns.js,browser.startup.homepage,%HomePageURL%) modifyProperties(langenus.xpi,bin/chrome/locales/en-US/navigator/locale/navigator.properties,browser.startup.homepage,%HomePageURL%)
modifyJS(browser.xpi,bin/defaults/pref/all-ns.js,browser.throbber.url,%AnimatedLogoURL%) modifyProperties(langenus.xpi,bin/chrome/locales/en-US/navigator/locale/navigator.properties,browser.throbber.url,%AnimatedLogoURL%)