mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Initial handling of configuration local cache files using onNext=Reload(dir) in INI file
This commit is contained in:
parent
e44ca27337
commit
6c469b2b32
@ -734,6 +734,36 @@ void CWizardMachineApp::ExecuteAction(char action)
|
||||
}
|
||||
}
|
||||
|
||||
CString CWizardMachineApp::replaceVars(char *str)
|
||||
{
|
||||
char buf[MIN_SIZE];
|
||||
char *b = buf;
|
||||
while (*str)
|
||||
{
|
||||
if (*str == '%')
|
||||
{
|
||||
char *n = ++str;
|
||||
while (*str && *str != '%')
|
||||
str++;
|
||||
if (*str == '%')
|
||||
{
|
||||
*str = '\0';
|
||||
WIDGET *w = findWidget(n);
|
||||
strcpy(b, w->value);
|
||||
b += strlen(w->value);
|
||||
}
|
||||
else
|
||||
exit(12);
|
||||
str++;
|
||||
}
|
||||
else
|
||||
*b++ = *str++;
|
||||
}
|
||||
*b = '\0';
|
||||
|
||||
return CString(buf);
|
||||
}
|
||||
|
||||
void CWizardMachineApp::GoToNextNode()
|
||||
{
|
||||
//check if it is a container node
|
||||
@ -745,8 +775,18 @@ void CWizardMachineApp::GoToNextNode()
|
||||
//----------------------------------------------------------------------------------------------
|
||||
if (CurrentNode->navControls->onNextAction)
|
||||
{
|
||||
if (strncmp(CurrentNode->navControls->onNextAction, "Reload", 6) == 0)
|
||||
char buf[MIN_SIZE];
|
||||
strcpy(buf, (char *)(LPCTSTR) CurrentNode->navControls->onNextAction);
|
||||
char *pcmd = strtok(buf, "(");
|
||||
if (pcmd)
|
||||
{
|
||||
char *parms = strtok(NULL, ")");
|
||||
if (strcmp(pcmd, "Reload") == 0)
|
||||
{
|
||||
CString newDir = replaceVars(parms);
|
||||
CachePath = Path + newDir + "\\" + CacheFile;
|
||||
FillGlobalWidgetArray(CachePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,6 +160,7 @@ public:
|
||||
char* GetBufferElement(const char *buffer, int index);
|
||||
char* GetSectionBuffer(CString iniFile, CString section);
|
||||
void ExecuteAction(char action);
|
||||
CString replaceVars(char *str);
|
||||
void GoToNextNode();
|
||||
void GoToPrevNode();
|
||||
void ExitApp();
|
||||
|
Loading…
Reference in New Issue
Block a user