Only put selected components in config's build

This commit is contained in:
selmer%netscape.com 1999-11-06 00:04:08 +00:00
parent 0aa1e7650e
commit 25e148a11b
3 changed files with 22 additions and 19 deletions

View File

@ -11,7 +11,8 @@ extern CString configPath;
extern CString workspacePath;
extern CString cdPath;
extern CString tempPath;
extern CString iniPath;
extern CString iniSrcPath;
extern CString iniDstPath;
extern CString scriptPath;
extern CString nscpxpiPath;
@ -19,7 +20,7 @@ extern COMPONENT Components[100];
extern int numComponents;
extern "C" __declspec(dllexport)
int BuildComponentList(COMPONENT *comps, int *compNum)
int BuildComponentList(COMPONENT *comps, int *compNum, CString iniSrcPath)
{
*compNum = 0;
@ -30,15 +31,15 @@ int BuildComponentList(COMPONENT *comps, int *compNum)
char desc[MAX_SIZE];
char attr[MAX_SIZE];
component.Format("Component%d", *compNum);
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniPath);
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath);
while (*archive)
{
GetPrivateProfileString(component, "Description Short", "",
name, MAX_SIZE, iniPath);
name, MAX_SIZE, iniSrcPath);
GetPrivateProfileString(component, "Description Long", "",
desc, MAX_SIZE, iniPath);
desc, MAX_SIZE, iniSrcPath);
GetPrivateProfileString(component, "Attributes", "",
attr, MAX_SIZE, iniPath);
attr, MAX_SIZE, iniSrcPath);
comps[*compNum].archive = CString(archive);
comps[*compNum].compname = component;
@ -50,7 +51,7 @@ int BuildComponentList(COMPONENT *comps, int *compNum)
(*compNum)++;
component.Format("Component%d", *compNum);
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniPath);
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath);
}
@ -69,9 +70,9 @@ int GenerateComponentList(CString parms, WIDGET *curWidget)
nscpxpiPath = workspacePath + "\\NSCPXPI";
else
nscpxpiPath = rootPath + "NSCPXPI";
iniPath = nscpxpiPath + "\\config.ini";
iniSrcPath = nscpxpiPath + "\\config.ini";
BuildComponentList(Components, &numComponents);
BuildComponentList(Components, &numComponents, iniSrcPath);
int i;
CString WidgetValue("");

View File

@ -8,4 +8,5 @@ typedef struct s_component {
BOOL launchapp;
} COMPONENT;
extern "C" __declspec(dllexport) int BuildComponentList(COMPONENT *comps, int *compNum);
extern "C" __declspec(dllexport)
int BuildComponentList(COMPONENT *comps, int *compNum, CString iniSrcPath);

View File

@ -15,7 +15,8 @@ CString configPath;
CString workspacePath;
CString cdPath;
CString tempPath;
CString iniPath;
CString iniDstPath;
CString iniSrcPath;
CString scriptPath;
CString nscpxpiPath;
@ -191,8 +192,7 @@ int interpret(char *cmd)
}
if (!section || !key || !newvalue)
return FALSE;
CString iniSrc = nscpxpiPath + "\\config.ini";
if (!CopyFile(iniSrc, iniPath, TRUE))
if (!CopyFile(iniSrcPath, iniDstPath, TRUE))
DWORD e = GetLastError();
if (strcmp(key, "Program Folder Name") == 0)
{
@ -200,7 +200,7 @@ int interpret(char *cmd)
strcat(temp, newvalue);
newvalue = temp;
}
WritePrivateProfileString(section, key, newvalue, iniPath);
WritePrivateProfileString(section, key, newvalue, iniDstPath);
}
else if (strcmp(cmdname, "replaceXPI") == 0)
{
@ -260,11 +260,11 @@ void init_components()
{
int i;
WIDGET *w = findWidget("SelectedComponents");
BuildComponentList(Components, &numComponents);
BuildComponentList(Components, &numComponents, iniSrcPath);
// Turn off components that aren't selected
for (i=0; i<numComponents; i++)
if (strstr(Components[i].name, w->value) == NULL)
if (strstr(w->value, Components[i].name) == NULL)
Components[i].selected = FALSE;
}
@ -281,13 +281,14 @@ int StartIB(CString parms, WIDGET *curWidget)
configPath = rootPath + "Configs\\" + configName;
cdPath = configPath + "\\CD";
tempPath = configPath + "\\Temp";
iniPath = cdPath + "\\config.ini";
iniDstPath = cdPath + "\\config.ini";
scriptPath = rootPath + "\\script.ib";
workspacePath = configPath + "\\Workspace";
if (SearchPath(workspacePath, "NSCPXPI", NULL, 0, NULL, NULL))
nscpxpiPath = workspacePath + "\\NSCPXPI";
else
nscpxpiPath = rootPath + "NSCPXPI";
iniSrcPath = nscpxpiPath + "\\config.ini";
init_components();
@ -344,8 +345,8 @@ int StartIB(CString parms, WIDGET *curWidget)
for (int i=0; i<numComponents; i++)
{
if (Components[i].selected)
CopyFile(nscpxpiPath + Components[i].archive,
cdPath + Components[i].archive, FALSE);
CopyFile(nscpxpiPath + "\\" + Components[i].archive,
cdPath + "\\" + Components[i].archive, TRUE);
}
// Didn't work...