зеркало из https://github.com/mozilla/gecko-dev.git
Support launching zulutest from zulu
This commit is contained in:
Родитель
92b4962700
Коммит
c3b4fdbea3
|
@ -996,6 +996,21 @@ nsresult nsCalendarShell::ReceiveCommand(nsString& aCommand, nsString& aReply)
|
|||
|
||||
nsresult nsCalendarShell::ExecuteCommandScript(nsString aScript)
|
||||
{
|
||||
/*
|
||||
* Make sure the CommandServer is running ...
|
||||
*/
|
||||
|
||||
StartCommandServer();
|
||||
|
||||
/*
|
||||
* Now launch the app that can handle scripting interaction with zulu
|
||||
*/
|
||||
|
||||
nsString script = "-s ";
|
||||
script += aScript;
|
||||
|
||||
mShellInstance->LaunchApplication(nsString("zulutest"),script);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ nsresult nsXPFCMenuContainer::ProcessActionCommand(nsString& aAction)
|
|||
|
||||
} else if (aAction == "LaunchCommandClient") {
|
||||
|
||||
mShellInstance->LaunchApplication(nsString("zulutest"));
|
||||
mShellInstance->LaunchApplication(nsString("zulutest"),nsString(""));
|
||||
|
||||
} else if (aAction == "ComposeEvent") {
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ public:
|
|||
|
||||
NS_IMETHOD_(EVENT_CALLBACK) GetShellEventCallback() ;
|
||||
|
||||
NS_IMETHOD LaunchApplication(nsString& aApplication) ;
|
||||
NS_IMETHOD LaunchApplication(nsString& aApplication,nsString& aArgument) ;
|
||||
|
||||
NS_IMETHOD GetCommandLineOptions(PLOptState** aOptState, const char * aOptions) ;
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
* Launch an application
|
||||
* @result nsresult NS_OK upon succcessful completion
|
||||
*/
|
||||
NS_IMETHOD LaunchApplication(nsString& aApplication) = 0 ;
|
||||
NS_IMETHOD LaunchApplication(nsString& aApplication, nsString& aArgument) = 0 ;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -440,19 +440,46 @@ EVENT_CALLBACK nsShellInstance::GetShellEventCallback()
|
|||
return ((EVENT_CALLBACK)HandleEventApplication);
|
||||
}
|
||||
|
||||
nsresult nsShellInstance::LaunchApplication(nsString& aApplication)
|
||||
nsresult nsShellInstance::LaunchApplication(nsString& aApplication, nsString& aArgument)
|
||||
{
|
||||
char * app = aApplication.ToNewCString();
|
||||
char *argv[2];
|
||||
|
||||
char * argument = nsnull;
|
||||
char *argv[100];
|
||||
PRStatus status ;
|
||||
|
||||
char path[1024];
|
||||
nsString temp;
|
||||
|
||||
/*
|
||||
* Build up app
|
||||
*/
|
||||
|
||||
(void)getcwd(path, sizeof(path));
|
||||
(void)PL_strcat(path, "\\");
|
||||
(void)PL_strcat(path, app);
|
||||
argv[0] = path;
|
||||
argv[1] = nsnull;
|
||||
|
||||
/*
|
||||
* Build up argument list
|
||||
*/
|
||||
|
||||
PRUint32 index = 1;
|
||||
|
||||
aArgument.Trim(" \r\n\t");
|
||||
PRInt32 offset = aArgument.Find(' ');
|
||||
|
||||
while(offset != -1)
|
||||
{
|
||||
aArgument.Left(temp,offset);
|
||||
aArgument.Cut(0,offset);
|
||||
aArgument.Trim(" \r\n\t",PR_TRUE,PR_FALSE);
|
||||
|
||||
argv[index++] = temp.ToNewCString();
|
||||
|
||||
offset = aArgument.Find(' ');
|
||||
}
|
||||
|
||||
argv[index++] = aArgument.ToNewCString();
|
||||
argv[index] = nsnull;
|
||||
|
||||
status = PR_CreateProcessDetached(argv[0], argv, nsnull, nsnull);
|
||||
|
||||
|
@ -461,6 +488,10 @@ nsresult nsShellInstance::LaunchApplication(nsString& aApplication)
|
|||
|
||||
delete app;
|
||||
|
||||
index = 1;
|
||||
while(argv[index] != nsnull)
|
||||
delete argv[index++];
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче