зеркало из https://github.com/mozilla/gecko-dev.git
Bug 113818 - CCK UI and backend need to be separated.
Merging CCK_IB_BRANCH into trunk reviewed by smeredith@netscape.com, shrutiv@netscape.com
This commit is contained in:
Родитель
c8fd45e23e
Коммит
4ecee92b1a
|
@ -50,7 +50,7 @@ Help=Online;%Root%CCKHelp\buildpage1.html
|
||||||
|
|
||||||
|
|
||||||
[Navigation Controls]
|
[Navigation Controls]
|
||||||
onNext=Message(Are you ready to build your customized installer? [Yes]/[No]);IBEngine.StartIB();Msg(Installer creation is complete. The build is in %Root%Configs\%CustomizationList%\Output)
|
onNext=Message(Are you ready to build your customized installer? [Yes]/[No]);RunIB();Msg(Installer creation is complete. The build is in %Root%Configs\%CustomizationList%\Output)
|
||||||
Help=InstallerHelp.ini
|
Help=InstallerHelp.ini
|
||||||
|
|
||||||
[Image 1]
|
[Image 1]
|
||||||
|
@ -93,7 +93,7 @@ target=CheckListDescription
|
||||||
;opt7=Description of the Import Utility
|
;opt7=Description of the Import Utility
|
||||||
;opt8=Description of the Internet Setup
|
;opt8=Description of the Internet Setup
|
||||||
;opt9=Description of the RealPlayer 5.0
|
;opt9=Description of the RealPlayer 5.0
|
||||||
onInit=IBEngine.GenerateComponentList()
|
onInit=globals.GenerateComponentList()
|
||||||
|
|
||||||
[Widget 2]
|
[Widget 2]
|
||||||
Type=GlobalText
|
Type=GlobalText
|
||||||
|
|
|
@ -1266,24 +1266,6 @@ BOOL CWizardMachineApp::IsFirstNode(NODE* treeNode)
|
||||||
return firstNode;
|
return firstNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString CWizardMachineApp::GetModulePath()
|
|
||||||
{
|
|
||||||
char currPath[MID_SIZE];
|
|
||||||
int i,numBytes;
|
|
||||||
|
|
||||||
// Get the path of the file that was executed
|
|
||||||
numBytes = GetModuleFileName(m_hInstance, currPath, MIN_SIZE);
|
|
||||||
|
|
||||||
// get the cmd path
|
|
||||||
// Remove the filename from the path
|
|
||||||
for (i=numBytes-1;i >= 0 && currPath[i] != '\\';i--);
|
|
||||||
// Terminate command line with 0
|
|
||||||
if (i >= 0)
|
|
||||||
currPath[i+1]= '\0';
|
|
||||||
|
|
||||||
return CString(currPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
CString CWizardMachineApp::GetGlobalOptions(CString theName)
|
CString CWizardMachineApp::GetGlobalOptions(CString theName)
|
||||||
{
|
{
|
||||||
CString temp="";
|
CString temp="";
|
||||||
|
|
|
@ -69,7 +69,6 @@ public:
|
||||||
void CreateNewCache();
|
void CreateNewCache();
|
||||||
BOOL IsLastNode(NODE* treeNode);
|
BOOL IsLastNode(NODE* treeNode);
|
||||||
BOOL IsFirstNode(NODE* treeNode);
|
BOOL IsFirstNode(NODE* treeNode);
|
||||||
CString GetModulePath();
|
|
||||||
CString GetGlobalOptions(CString theName);
|
CString GetGlobalOptions(CString theName);
|
||||||
void BuildWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex, BOOL readValue);
|
void BuildWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex, BOOL readValue);
|
||||||
// void BuildHelpWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex);
|
// void BuildHelpWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex);
|
||||||
|
|
|
@ -612,6 +612,9 @@ BOOL CInterpret::interpret(char *cmds, WIDGET *curWidget)
|
||||||
|
|
||||||
BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CString quotes = "\"";
|
||||||
|
|
||||||
// Make modifiable copy of string's buffer
|
// Make modifiable copy of string's buffer
|
||||||
char buf[MAX_SIZE];
|
char buf[MAX_SIZE];
|
||||||
strcpy(buf, (char *)(LPCTSTR) cmds);
|
strcpy(buf, (char *)(LPCTSTR) cmds);
|
||||||
|
@ -874,7 +877,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
||||||
CString outputPath = rootPath + "Configs\\" + configName + "\\Output";
|
CString outputPath = rootPath + "Configs\\" + configName + "\\Output";
|
||||||
char deletePath[MAX_SIZE];
|
char deletePath[MAX_SIZE];
|
||||||
strcpy(deletePath, outputPath);
|
strcpy(deletePath, outputPath);
|
||||||
CallDLL("IBEngine", "EraseDirectory", deletePath, w);
|
EraseDirectory(deletePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// change pre-set CD autorun option
|
// change pre-set CD autorun option
|
||||||
|
@ -888,7 +891,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
||||||
CString outputPath = rootPath + "Configs\\" + configName + "\\Output";
|
CString outputPath = rootPath + "Configs\\" + configName + "\\Output";
|
||||||
char deletePath[MAX_SIZE];
|
char deletePath[MAX_SIZE];
|
||||||
strcpy(deletePath, outputPath);
|
strcpy(deletePath, outputPath);
|
||||||
CallDLL("IBEngine", "EraseDirectory", deletePath, w);
|
EraseDirectory(deletePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(pcmd, "WriteCache") ==0)
|
else if (strcmp(pcmd, "WriteCache") ==0)
|
||||||
|
@ -1203,6 +1206,32 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (strcmp(pcmd, "RunIB") == 0)
|
||||||
|
{
|
||||||
|
//Make sure _NewConfigName is defined
|
||||||
|
if(GetGlobal("_NewConfigName") != GetGlobal("CustomizationList"))
|
||||||
|
SetGlobal("_NewConfigName", GetGlobal("CustomizationList"));
|
||||||
|
|
||||||
|
//Create an updated .che
|
||||||
|
theApp.CreateNewCache();
|
||||||
|
|
||||||
|
CString exec_command = "ibengine.exe -c " + quotes
|
||||||
|
+ CachePath + quotes;
|
||||||
|
|
||||||
|
CNewDialog newprog;
|
||||||
|
newprog.Create(IDD_NEW_DIALOG,NULL );
|
||||||
|
newprog.ShowWindow(SW_SHOW);
|
||||||
|
CWnd * dlg;
|
||||||
|
CRect tmpRect = CRect(7,7,173,13);
|
||||||
|
dlg = newprog.GetDlgItem(IDC_BASE_TEXT);
|
||||||
|
CWnd* pwnd = newprog.GetDlgItem(IDD_NEW_DIALOG);
|
||||||
|
newprog.SetWindowText("Progress");
|
||||||
|
dlg->SetWindowText(" Customization is in Progress ... ");
|
||||||
|
|
||||||
|
ExecuteCommand((char *)(LPCTSTR) exec_command, SW_HIDE, INFINITE);
|
||||||
|
|
||||||
|
newprog.DestroyWindow();
|
||||||
|
}
|
||||||
else if (strcmp(pcmd, "ShowSection") == 0)
|
else if (strcmp(pcmd, "ShowSection") == 0)
|
||||||
{
|
{
|
||||||
// ShowSection is a way to use a listbox to choose a subset of widgets to display.
|
// ShowSection is a way to use a listbox to choose a subset of widgets to display.
|
||||||
|
|
|
@ -0,0 +1,198 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "globals.h"
|
||||||
|
#include "comp.h"
|
||||||
|
#include <direct.h>
|
||||||
|
|
||||||
|
#define MAX_SIZE 1024
|
||||||
|
|
||||||
|
CString rootPath;
|
||||||
|
CString configName;
|
||||||
|
CString configPath;
|
||||||
|
CString workspacePath;
|
||||||
|
CString cdPath;
|
||||||
|
CString tempPath;
|
||||||
|
CString iniSrcPath;
|
||||||
|
CString iniDstPath;
|
||||||
|
CString scriptPath;
|
||||||
|
CString nscpxpiPath;
|
||||||
|
|
||||||
|
CString linuxOption;
|
||||||
|
CString linuxblobPath;
|
||||||
|
CString linuxDir;
|
||||||
|
CString nsinstPath;
|
||||||
|
CString xpiDir;
|
||||||
|
CString tarfile;
|
||||||
|
CString quotes;
|
||||||
|
|
||||||
|
COMPONENT Components[100];
|
||||||
|
int numComponents;
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport)
|
||||||
|
int BuildComponentList(COMPONENT *comps, int *compNum, CString iniSrcPath,
|
||||||
|
int invisibleCount)
|
||||||
|
{
|
||||||
|
*compNum = 0;
|
||||||
|
int invNum = *compNum;
|
||||||
|
CString componentstr;
|
||||||
|
|
||||||
|
// Get all the component info from each component section
|
||||||
|
char component[MAX_SIZE];
|
||||||
|
char archive[MAX_SIZE];
|
||||||
|
char name[MAX_SIZE];
|
||||||
|
char desc[MAX_SIZE];
|
||||||
|
char attr[MAX_SIZE];
|
||||||
|
char tempcomponentstr[MAX_SIZE];
|
||||||
|
|
||||||
|
componentstr.Format("C%d", *compNum);
|
||||||
|
strcpy(tempcomponentstr, componentstr);
|
||||||
|
GetPrivateProfileString("Setup Type2", tempcomponentstr, "", component,
|
||||||
|
MAX_SIZE, iniSrcPath);
|
||||||
|
|
||||||
|
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE,
|
||||||
|
iniSrcPath);
|
||||||
|
while (*archive)
|
||||||
|
{
|
||||||
|
GetPrivateProfileString(component, "Description Short", "",
|
||||||
|
name, MAX_SIZE, iniSrcPath);
|
||||||
|
GetPrivateProfileString(component, "Description Long", "",
|
||||||
|
desc, MAX_SIZE, iniSrcPath);
|
||||||
|
GetPrivateProfileString(component, "Attributes", "",
|
||||||
|
attr, MAX_SIZE, iniSrcPath);
|
||||||
|
|
||||||
|
if (strcmp(component, "Component AOD") == 0)
|
||||||
|
strcpy(attr, "SELECTED");
|
||||||
|
|
||||||
|
comps[*compNum].archive = CString(archive);
|
||||||
|
comps[*compNum].compname = component;
|
||||||
|
comps[*compNum].name = CString(name);
|
||||||
|
comps[*compNum].desc = CString(desc);
|
||||||
|
comps[*compNum].selected = (strstr(attr, "SELECTED") != NULL);
|
||||||
|
comps[*compNum].invisible = (strstr(attr, "INVISIBLE") != NULL);
|
||||||
|
comps[*compNum].launchapp = (strstr(attr, "LAUNCHAPP") != NULL);
|
||||||
|
comps[*compNum].additional = (strstr(attr, "ADDITIONAL") != NULL);
|
||||||
|
comps[*compNum].disabled = (strstr(attr, "DISABLED") != NULL);
|
||||||
|
comps[*compNum].forceupgrade = (strstr(attr, "FORCE_UPGRADE") != NULL);
|
||||||
|
comps[*compNum].uncompress = (strstr(attr, "UNCOMPRESS") != NULL);
|
||||||
|
comps[*compNum].downloadonly = (strstr(attr, "DOWNLOAD_ONLY") != NULL);
|
||||||
|
comps[*compNum].unselected = (strstr(attr, "UNSELECTED") != NULL);
|
||||||
|
comps[*compNum].empty = strcmp(attr, "");
|
||||||
|
|
||||||
|
if (!(comps[*compNum].selected && comps[*compNum].invisible &&
|
||||||
|
invisibleCount))
|
||||||
|
{
|
||||||
|
(*compNum)++;
|
||||||
|
invNum++;
|
||||||
|
componentstr.Format("C%d", invNum);
|
||||||
|
strcpy(tempcomponentstr, componentstr);
|
||||||
|
GetPrivateProfileString("Setup Type2", tempcomponentstr, "",
|
||||||
|
component, MAX_SIZE, iniSrcPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
invNum++;
|
||||||
|
componentstr.Format("C%d", invNum);
|
||||||
|
strcpy(tempcomponentstr, componentstr);
|
||||||
|
GetPrivateProfileString("Setup Type2", tempcomponentstr, "",
|
||||||
|
component, MAX_SIZE, iniSrcPath);
|
||||||
|
}
|
||||||
|
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE,
|
||||||
|
iniSrcPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport)
|
||||||
|
int GenerateComponentList(CString parms, WIDGET *curWidget)
|
||||||
|
{
|
||||||
|
rootPath = GetGlobal("Root");
|
||||||
|
configName = GetGlobal("CustomizationList");
|
||||||
|
configPath = rootPath + "Configs\\" + configName;
|
||||||
|
workspacePath = configPath + "\\Workspace";
|
||||||
|
nscpxpiPath;
|
||||||
|
|
||||||
|
linuxOption = GetGlobal("lPlatform");
|
||||||
|
if (linuxOption == "Linux")
|
||||||
|
{
|
||||||
|
linuxblobPath = GetGlobal("LinuxPath");
|
||||||
|
linuxDir = "nscpxpiLinux";
|
||||||
|
nsinstPath = "\\netscape-installer\\xpi";
|
||||||
|
xpiDir = "\\xpi";
|
||||||
|
CString tnscpxpilinuxPath = rootPath + linuxDir;
|
||||||
|
CString nscpxpilinuxPath = tnscpxpilinuxPath;
|
||||||
|
int pathlen = linuxblobPath.GetLength();
|
||||||
|
int pos = linuxblobPath.ReverseFind('\\');
|
||||||
|
pos += 1;
|
||||||
|
CString linuxinstDirPath = linuxblobPath.Left(pos);
|
||||||
|
tarfile = linuxblobPath.Right(pathlen-pos);
|
||||||
|
|
||||||
|
int direxist = GetFileAttributes(nscpxpilinuxPath);
|
||||||
|
if ((direxist == -1) && (linuxblobPath != ""))
|
||||||
|
// nscpxpiLinux directory does not exist
|
||||||
|
{
|
||||||
|
quotes = "\"";
|
||||||
|
char currentdir[_MAX_PATH];
|
||||||
|
_getcwd(currentdir, _MAX_PATH);
|
||||||
|
_chdir(rootPath);
|
||||||
|
_mkdir(linuxDir);
|
||||||
|
_chdir(linuxinstDirPath);
|
||||||
|
tnscpxpilinuxPath.Replace("\\","/");
|
||||||
|
tnscpxpilinuxPath.Replace(":","");
|
||||||
|
tnscpxpilinuxPath.Insert(0,"/cygdrive/");
|
||||||
|
CString command = "tar -zxvf " + tarfile + " -C " + quotes + tnscpxpilinuxPath + quotes;
|
||||||
|
ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE);
|
||||||
|
|
||||||
|
nscpxpiPath = nscpxpilinuxPath + nsinstPath;
|
||||||
|
CString tempxpiPath = nscpxpiPath;
|
||||||
|
tempxpiPath.Replace(xpiDir,"");
|
||||||
|
CopyFile(tempxpiPath+"\\Config.ini", nscpxpiPath+"\\Config.ini",
|
||||||
|
FALSE);
|
||||||
|
_chdir(currentdir);
|
||||||
|
}
|
||||||
|
nscpxpiPath = nscpxpilinuxPath + nsinstPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (SearchPath(workspacePath, "NSCPXPI", NULL, 0, NULL, NULL))
|
||||||
|
nscpxpiPath = workspacePath + "\\NSCPXPI";
|
||||||
|
else
|
||||||
|
nscpxpiPath = rootPath + "NSCPXPI";
|
||||||
|
}
|
||||||
|
iniSrcPath = nscpxpiPath + "\\config.ini";
|
||||||
|
|
||||||
|
BuildComponentList(Components, &numComponents, iniSrcPath, 1);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
CString WidgetValue("");
|
||||||
|
for (i=0; i<numComponents; i++)
|
||||||
|
{
|
||||||
|
curWidget->options.name[i] = new char[strlen(Components[i].compname)+1];
|
||||||
|
strcpy(curWidget->options.name[i], Components[i].compname);
|
||||||
|
|
||||||
|
curWidget->options.value[i] = new char[strlen(Components[i].name)+1];
|
||||||
|
strcpy(curWidget->options.value[i], Components[i].name);
|
||||||
|
|
||||||
|
curWidget->optDesc.name[i] = new char[strlen(Components[i].compname)+1];
|
||||||
|
strcpy(curWidget->optDesc.name[i], Components[i].compname);
|
||||||
|
|
||||||
|
curWidget->optDesc.value[i] = new char[strlen(Components[i].desc)+1];
|
||||||
|
strcpy(curWidget->optDesc.value[i], Components[i].desc);
|
||||||
|
|
||||||
|
// INVISIBLE just means not selected, let user decide whether to
|
||||||
|
// include them again. SELECTED components get checkmarks.
|
||||||
|
if (Components[i].selected)
|
||||||
|
{
|
||||||
|
WidgetValue += ",";
|
||||||
|
WidgetValue += Components[i].name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curWidget->numOfOptions = numComponents;
|
||||||
|
curWidget->numOfOptDesc = numComponents;
|
||||||
|
|
||||||
|
if (curWidget->value.IsEmpty())
|
||||||
|
curWidget->value = WidgetValue;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
typedef struct s_component {
|
||||||
|
CString archive;
|
||||||
|
CString compname;
|
||||||
|
CString name;
|
||||||
|
CString desc;
|
||||||
|
BOOL selected;
|
||||||
|
BOOL invisible;
|
||||||
|
BOOL launchapp;
|
||||||
|
BOOL additional;
|
||||||
|
BOOL disabled;
|
||||||
|
BOOL forceupgrade;
|
||||||
|
BOOL uncompress;
|
||||||
|
BOOL downloadonly;
|
||||||
|
BOOL unselected;
|
||||||
|
BOOL empty;
|
||||||
|
|
||||||
|
} COMPONENT;
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport)
|
||||||
|
int BuildComponentList(COMPONENT *comps, int *compNum, CString iniSrcPath,int invisibleCount);
|
|
@ -137,3 +137,43 @@ void ExecuteCommand(char *command, int showflag, DWORD wait)
|
||||||
WaitForSingleObject(processInfo.hProcess, wait);
|
WaitForSingleObject(processInfo.hProcess, wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport)
|
||||||
|
void EraseDirectory(CString sPath)
|
||||||
|
{
|
||||||
|
CFileFind finder;
|
||||||
|
CString sFullPath = sPath + "\\*.*";
|
||||||
|
|
||||||
|
BOOL bWorking = finder.FindFile(sFullPath);
|
||||||
|
while (bWorking)
|
||||||
|
{
|
||||||
|
bWorking = finder.FindNextFile();
|
||||||
|
if (finder.IsDots()) continue;
|
||||||
|
if (finder.IsDirectory())
|
||||||
|
{
|
||||||
|
CString dirPath = finder.GetFilePath();
|
||||||
|
EraseDirectory(dirPath);
|
||||||
|
_rmdir(finder.GetFilePath());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
_unlink( finder.GetFilePath() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__declspec(dllexport)
|
||||||
|
CString GetModulePath()
|
||||||
|
{
|
||||||
|
char currPath[MID_SIZE];
|
||||||
|
int i,numBytes;
|
||||||
|
|
||||||
|
// Get the path of the file that was executed
|
||||||
|
numBytes = GetModuleFileName(NULL, currPath, MIN_SIZE);
|
||||||
|
|
||||||
|
// get the cmd path
|
||||||
|
// Remove the filename from the path
|
||||||
|
for (i=numBytes-1;i >= 0 && currPath[i] != '\\';i--);
|
||||||
|
// Terminate command line with 0
|
||||||
|
if (i >= 0)
|
||||||
|
currPath[i+1]= '\0';
|
||||||
|
|
||||||
|
return CString(currPath);
|
||||||
|
}
|
||||||
|
|
|
@ -12,3 +12,5 @@ extern "C" __declspec(dllimport) WIDGET* findWidget(CString theName);
|
||||||
extern "C" __declspec(dllimport) void CopyDir(CString from, CString to, LPCTSTR extension, int overwrite);
|
extern "C" __declspec(dllimport) void CopyDir(CString from, CString to, LPCTSTR extension, int overwrite);
|
||||||
extern "C" __declspec(dllexport) void ExecuteCommand(char *command, int showflag, DWORD wait);
|
extern "C" __declspec(dllexport) void ExecuteCommand(char *command, int showflag, DWORD wait);
|
||||||
extern "C" __declspec(dllimport) int GetAttrib(CString theValue, char* attribArray[]);
|
extern "C" __declspec(dllimport) int GetAttrib(CString theValue, char* attribArray[]);
|
||||||
|
extern "C" __declspec(dllimport) void EraseDirectory(CString sPath);
|
||||||
|
__declspec(dllimport) CString GetModulePath();
|
||||||
|
|
|
@ -31,6 +31,7 @@ IS_COMPONENT = 1
|
||||||
|
|
||||||
OBJS= \
|
OBJS= \
|
||||||
.\$(OBJDIR)\globals.obj \
|
.\$(OBJDIR)\globals.obj \
|
||||||
|
.\$(OBJDIR)\comp.obj \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LINCS= $(LINCS) \
|
LINCS= $(LINCS) \
|
||||||
|
@ -70,8 +71,9 @@ include <$(DEPTH)\config\rules.mak>
|
||||||
|
|
||||||
include <$(DEPTH)\cck\InitDist.win>
|
include <$(DEPTH)\cck\InitDist.win>
|
||||||
|
|
||||||
export:: $(DLLNAME).h
|
export::
|
||||||
$(MAKE_INSTALL) $(DLLNAME).h ..\include
|
$(MAKE_INSTALL) globals.h ..\include
|
||||||
|
$(MAKE_INSTALL) comp.h ..\include
|
||||||
|
|
||||||
libs:: $(DLL)
|
libs:: $(DLL)
|
||||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib ..\lib
|
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib ..\lib
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include <Winbase.h>
|
||||||
|
#include <direct.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ib.h"
|
||||||
|
#include "globals.h"
|
||||||
|
#include "fstream.h"
|
||||||
|
#include <afxtempl.h>
|
||||||
|
#include <afxdisp.h>
|
||||||
|
#include "resource.h"
|
||||||
|
#include "NewDialog.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
CString configPath;
|
||||||
|
CString rootPath;
|
||||||
|
CString templateDir;
|
||||||
|
CString configname;
|
||||||
|
CString configpath;
|
||||||
|
CString che_path;
|
||||||
|
CString che_file;
|
||||||
|
|
||||||
|
|
||||||
|
if(argc == 3)
|
||||||
|
{
|
||||||
|
configPath = argv[2];
|
||||||
|
FillGlobalWidgetArray(configPath);
|
||||||
|
|
||||||
|
if(!strcmp(argv[1], "-c"))
|
||||||
|
{
|
||||||
|
//The option "-c" means that ibengine.exe
|
||||||
|
//was called from wizardmachine.exe
|
||||||
|
|
||||||
|
StartIB();
|
||||||
|
}
|
||||||
|
else if(!strcmp(argv[1], "-u"))
|
||||||
|
{
|
||||||
|
//The option "-u" means that the user is
|
||||||
|
//running ibengine.exe via command line
|
||||||
|
|
||||||
|
rootPath = GetModulePath();
|
||||||
|
templateDir = rootPath + "WSTemplate";
|
||||||
|
configname = GetGlobal("_NewConfigName");
|
||||||
|
configpath = rootPath + "Configs\\" + configname;
|
||||||
|
|
||||||
|
//Grab exact name of the .che file from configPath
|
||||||
|
che_file = configPath;
|
||||||
|
int extractposition = che_file.ReverseFind('\\');
|
||||||
|
extractposition++;
|
||||||
|
extractposition = (che_file.GetLength()) - extractposition;
|
||||||
|
che_file = che_file.Right(extractposition);
|
||||||
|
|
||||||
|
//These are some commands that we only want to run if
|
||||||
|
//ibengine.exe is run at command line
|
||||||
|
|
||||||
|
//Create the config path
|
||||||
|
_mkdir(configpath);
|
||||||
|
|
||||||
|
//Copy files and directories from WSTemplate
|
||||||
|
//to new config directory
|
||||||
|
CopyDir(templateDir, configpath, NULL, FALSE);
|
||||||
|
|
||||||
|
//Copy the .che file given on command line to the
|
||||||
|
//appropriate directory
|
||||||
|
che_path = configpath + "\\" + che_file;
|
||||||
|
CopyFile(configPath, che_path, FALSE);
|
||||||
|
|
||||||
|
StartIB();
|
||||||
|
|
||||||
|
printf("\nInstaller creation is complete. The build is "
|
||||||
|
"in %sConfigs\\%s\\Output\n", rootPath, configname);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\nYou have supplied incorrect command line options. \n"
|
||||||
|
"Please, run either \"WizardMachine.exe\" "
|
||||||
|
"or \"ibengine.exe -u <your_config_file_path>\"\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\nYou have supplied incorrect command line options. \n"
|
||||||
|
"Please, run either \"WizardMachine.exe\" "
|
||||||
|
"or \"ibengine.exe -u <your_config_file_path>\"\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
101
cck/ib/ib.cpp
101
cck/ib/ib.cpp
|
@ -1239,28 +1239,6 @@ CString GetBrowser(void)
|
||||||
return retflag;
|
return retflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" __declspec(dllexport)
|
|
||||||
void EraseDirectory(CString sPath)
|
|
||||||
{
|
|
||||||
CFileFind finder;
|
|
||||||
CString sFullPath = sPath + "\\*.*";
|
|
||||||
|
|
||||||
BOOL bWorking = finder.FindFile(sFullPath);
|
|
||||||
while (bWorking)
|
|
||||||
{
|
|
||||||
bWorking = finder.FindNextFile();
|
|
||||||
if (finder.IsDots()) continue;
|
|
||||||
if (finder.IsDirectory())
|
|
||||||
{
|
|
||||||
CString dirPath = finder.GetFilePath();
|
|
||||||
EraseDirectory(dirPath);
|
|
||||||
_rmdir(finder.GetFilePath());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
_unlink( finder.GetFilePath() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CopyDirectory(CString source, CString dest, BOOL subdir)
|
void CopyDirectory(CString source, CString dest, BOOL subdir)
|
||||||
// Copy files in subdirectories if the subdir flag is set (equal to 1).
|
// Copy files in subdirectories if the subdir flag is set (equal to 1).
|
||||||
{
|
{
|
||||||
|
@ -1390,15 +1368,60 @@ void DiskSpaceAlert(ULONGLONG required, ULONGLONG available)
|
||||||
AfxMessageBox("Not enough disk space. Required: "+requiredSpace+" bytes. Available: "+availableSpace+" bytes.", MB_OK);
|
AfxMessageBox("Not enough disk space. Required: "+requiredSpace+" bytes. Available: "+availableSpace+" bytes.", MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" __declspec(dllexport)
|
|
||||||
int StartIB(CString parms, WIDGET *curWidget)
|
|
||||||
|
BOOL FillGlobalWidgetArray(CString file)
|
||||||
|
{
|
||||||
|
char buffer[MAX_SIZE] = {'\0'};
|
||||||
|
CString name = "";
|
||||||
|
CString value = "";
|
||||||
|
|
||||||
|
FILE *globs = fopen(file, "r");
|
||||||
|
if (!globs)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
while(!feof(globs))
|
||||||
|
{
|
||||||
|
while(fgets(buffer, MAX_SIZE, globs))
|
||||||
|
{
|
||||||
|
if (strstr(buffer, "="))
|
||||||
|
{
|
||||||
|
name = CString(strtok(buffer,"="));
|
||||||
|
value = CString(strtok(NULL,"="));
|
||||||
|
value.TrimRight();
|
||||||
|
if (value.Find("%") >= 0) {
|
||||||
|
//We should never enter this condition via wizardmachine.exe
|
||||||
|
AfxMessageBox("The current .che file called: "+file+" contains some unfilled parameters."
|
||||||
|
"These parameters will appear between two percent (%) signs such as %Root%"
|
||||||
|
"Please replace these parameters with their appropriate values and restart"
|
||||||
|
"the program", MB_OK);
|
||||||
|
// value=theInterpreter->replaceVars((char *) (LPCSTR) value,NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
WIDGET* w = SetGlobal(name, value);
|
||||||
|
if (w)
|
||||||
|
w->cached = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(globs);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int StartIB(/*CString parms, WIDGET *curWidget*/)
|
||||||
{
|
{
|
||||||
char *fgetsrv;
|
char *fgetsrv;
|
||||||
int rv = TRUE;
|
int rv = TRUE;
|
||||||
char olddir[1024];
|
char olddir[1024];
|
||||||
componentOrder =0;
|
componentOrder =0;
|
||||||
rootPath = GetGlobal("Root");
|
rootPath = GetModulePath();
|
||||||
configName = GetGlobal("CustomizationList");
|
SetGlobal("Root", rootPath);
|
||||||
|
configName = GetGlobal("_NewConfigName");
|
||||||
|
SetGlobal("CustomizationList", configName);
|
||||||
configPath = rootPath + "Configs\\" + configName;
|
configPath = rootPath + "Configs\\" + configName;
|
||||||
outputPath = configPath + "\\Output";
|
outputPath = configPath + "\\Output";
|
||||||
cdPath = configPath + "\\Output\\Core";
|
cdPath = configPath + "\\Output\\Core";
|
||||||
|
@ -1448,7 +1471,11 @@ int StartIB(CString parms, WIDGET *curWidget)
|
||||||
CopyFile(nscpxpiPath+"\\recommended.end",
|
CopyFile(nscpxpiPath+"\\recommended.end",
|
||||||
templinuxPath+"\\xpi\\recommended.end", FALSE);
|
templinuxPath+"\\xpi\\recommended.end", FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iniSrcPath = nscpxpiPath + "\\config.ini";
|
iniSrcPath = nscpxpiPath + "\\config.ini";
|
||||||
|
|
||||||
//Check for disk space before continuing
|
//Check for disk space before continuing
|
||||||
|
|
||||||
ULARGE_INTEGER nTotalBytes, nTotalFreeBytes, nTotalAvailable;
|
ULARGE_INTEGER nTotalBytes, nTotalFreeBytes, nTotalAvailable;
|
||||||
|
@ -1570,16 +1597,6 @@ int StartIB(CString parms, WIDGET *curWidget)
|
||||||
iniDstPath = outputPath + "\\config.ini";
|
iniDstPath = outputPath + "\\config.ini";
|
||||||
xpiDstPath = outputPath;
|
xpiDstPath = outputPath;
|
||||||
}
|
}
|
||||||
CNewDialog newprog;
|
|
||||||
newprog.Create(IDD_NEW_DIALOG,NULL );
|
|
||||||
newprog.ShowWindow(SW_SHOW);
|
|
||||||
/////////////////////////////
|
|
||||||
CWnd * dlg;
|
|
||||||
CRect tmpRect = CRect(7,7,173,13);
|
|
||||||
dlg = newprog.GetDlgItem(IDC_BASE_TEXT);
|
|
||||||
CWnd* pwnd = newprog.GetDlgItem(IDD_NEW_DIALOG);
|
|
||||||
dlg->SetWindowText(" Customization is in Progress");
|
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
_mkdir((char *)(LPCTSTR) tempPath);
|
_mkdir((char *)(LPCTSTR) tempPath);
|
||||||
_mkdir((char *)(LPCTSTR) workspacePath);
|
_mkdir((char *)(LPCTSTR) workspacePath);
|
||||||
|
@ -1627,16 +1644,13 @@ int StartIB(CString parms, WIDGET *curWidget)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
ReplaceJARFiles();
|
||||||
|
|
||||||
dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||");
|
|
||||||
|
|
||||||
ReplaceXPIFiles();
|
ReplaceXPIFiles();
|
||||||
|
|
||||||
dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||");
|
|
||||||
|
|
||||||
// Copy remaining default installer files into config
|
// Copy remaining default installer files into config
|
||||||
// preserving any existing files that we created already
|
// preserving any existing files that we created already
|
||||||
|
@ -1705,30 +1719,23 @@ int StartIB(CString parms, WIDGET *curWidget)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Didn't work...
|
// Didn't work...
|
||||||
dlg->SetWindowText(" Customization is in Progress \n |||||||||||||||||||||||||||");
|
|
||||||
|
|
||||||
if (linuxOption == "Linux")
|
if (linuxOption == "Linux")
|
||||||
{
|
{
|
||||||
LinuxInvisible();
|
LinuxInvisible();
|
||||||
dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||||||||||||||||||||");
|
|
||||||
AddThirdParty();
|
AddThirdParty();
|
||||||
dlg->SetWindowText(" Customization is in Progress \n |||||||||||||||||||||||||||||||||||||||||||||");
|
|
||||||
CreateLinuxInstaller();
|
CreateLinuxInstaller();
|
||||||
dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||||||||||||||||||||||||||||||||||||||");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
invisible();
|
invisible();
|
||||||
|
|
||||||
dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||||||||||||||||||||");
|
|
||||||
|
|
||||||
AddThirdParty();
|
AddThirdParty();
|
||||||
|
|
||||||
dlg->SetWindowText(" Customization is in Progress \n |||||||||||||||||||||||||||||||||||||||||||||");
|
|
||||||
|
|
||||||
ReplaceINIFile();
|
ReplaceINIFile();
|
||||||
|
|
||||||
dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||||||||||||||||||||||||||||||||||||||");
|
|
||||||
}
|
}
|
||||||
SetCurrentDirectory(olddir);
|
SetCurrentDirectory(olddir);
|
||||||
CString TargetDir = GetGlobal("Root");
|
CString TargetDir = GetGlobal("Root");
|
||||||
|
@ -1736,8 +1743,6 @@ int StartIB(CString parms, WIDGET *curWidget)
|
||||||
CString MozBrowser = GetBrowser();
|
CString MozBrowser = GetBrowser();
|
||||||
// CreateShortcut(MozBrowser, TargetFile, "HelpLink", TargetDir, FALSE);
|
// CreateShortcut(MozBrowser, TargetFile, "HelpLink", TargetDir, FALSE);
|
||||||
|
|
||||||
dlg->SetWindowText(" Customization is in Progress \n |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
|
|
||||||
newprog.DestroyWindow();
|
|
||||||
EraseDirectory(tempPath);
|
EraseDirectory(tempPath);
|
||||||
_chdir(configPath);
|
_chdir(configPath);
|
||||||
_rmdir("Temp");
|
_rmdir("Temp");
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#define MID_SIZE 512
|
||||||
|
|
||||||
typedef struct s_xpi {
|
typedef struct s_xpi {
|
||||||
CString xpiname;
|
CString xpiname;
|
||||||
CString filename;
|
CString filename;
|
||||||
|
@ -7,6 +9,8 @@ typedef struct s_jar {
|
||||||
CString filename;
|
CString filename;
|
||||||
} JAR;
|
} JAR;
|
||||||
|
|
||||||
|
int StartIB(void);
|
||||||
|
BOOL FillGlobalWidgetArray(CString);
|
||||||
void CreateRshell(void);
|
void CreateRshell(void);
|
||||||
void CreateHelpMenu(void);
|
void CreateHelpMenu(void);
|
||||||
void CreateBuddyList(void);
|
void CreateBuddyList(void);
|
||||||
|
|
|
@ -35,9 +35,9 @@ OBJS= \
|
||||||
.\$(OBJDIR)\NewDialog.obj \
|
.\$(OBJDIR)\NewDialog.obj \
|
||||||
.\$(OBJDIR)\wizshell.obj \
|
.\$(OBJDIR)\wizshell.obj \
|
||||||
.\$(OBJDIR)\ib.obj \
|
.\$(OBJDIR)\ib.obj \
|
||||||
.\$(OBJDIR)\comp.obj \
|
|
||||||
.\$(OBJDIR)\Helpmenu.obj \
|
.\$(OBJDIR)\Helpmenu.obj \
|
||||||
.\$(OBJDIR)\buddylist.obj \
|
.\$(OBJDIR)\buddylist.obj \
|
||||||
|
.\$(OBJDIR)\engine.obj \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# -I$(DEPTH)\xpinstall\wizard\windows\setup \
|
# -I$(DEPTH)\xpinstall\wizard\windows\setup \
|
||||||
|
@ -47,9 +47,13 @@ LINCS= $(LINCS) \
|
||||||
-I$(DIST)\$(OBJDIR)\include \
|
-I$(DIST)\$(OBJDIR)\include \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
MAKE_OBJ_TYPE = DLL
|
MAKE_OBJ_TYPE = EXE
|
||||||
DLLNAME = ibengine
|
EXENAME = ibengine
|
||||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
MAPFILE = ib.map
|
||||||
|
RESFILE = ib.res
|
||||||
|
PDBFILE = $(EXENAME)
|
||||||
|
|
||||||
|
PROGRAM=.\$(OBJDIR)\$(EXENAME).exe
|
||||||
|
|
||||||
CFLAGS = \
|
CFLAGS = \
|
||||||
-W3 \
|
-W3 \
|
||||||
|
@ -80,15 +84,17 @@ include <$(DEPTH)\config\rules.mak>
|
||||||
|
|
||||||
include <$(DEPTH)\cck\InitDist.win>
|
include <$(DEPTH)\cck\InitDist.win>
|
||||||
|
|
||||||
libs:: $(DLL)
|
libs:: $(PROGRAM)
|
||||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(CCKDIST)\CCKTool
|
$(MAKE_INSTALL) $(PROGRAM) $(CCKDIST)\CCKTool
|
||||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib ..\lib
|
$(MAKE_INSTALL) .\$(OBJDIR)\$(EXENAME).lib ..\lib
|
||||||
|
|
||||||
export::
|
export::
|
||||||
$(MAKE_INSTALL) script.ib $(CCKDIST)\CCKTool
|
$(MAKE_INSTALL) script.ib $(CCKDIST)\CCKTool
|
||||||
$(MAKE_INSTALL) help1.txt $(CCKDIST)\CCKTool
|
$(MAKE_INSTALL) help1.txt $(CCKDIST)\CCKTool
|
||||||
$(MAKE_INSTALL) help2.txt $(CCKDIST)\CCKTool
|
$(MAKE_INSTALL) help2.txt $(CCKDIST)\CCKTool
|
||||||
|
|
||||||
|
$(PROGRAM):: $(OBJDIR) $(OBJS) $(RESFILE)
|
||||||
|
|
||||||
#clobber::
|
#clobber::
|
||||||
# rm -f $(DIST)\bin\$(DLLNAME).dll
|
# rm -f $(DIST)\bin\$(DLLNAME).dll
|
||||||
# rm -f $(DIST)\lib\$(DLLNAME).lib
|
# rm -f $(DIST)\lib\$(DLLNAME).lib
|
||||||
|
|
Загрузка…
Ссылка в новой задаче