* _LaunchApp() will now retry launching the app if the initial try ended with
an invalid META:PPATH attribute. * _ResolveApp() now also sets the _wasDocument variable correctly for the _TranslateType() case. This lets _LaunchApp() properly detected invalid META:PPATH attributes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39419 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b15f7f0ed5
commit
4697f6ac33
@ -2249,31 +2249,36 @@ BRoster::_LaunchApp(const char* mimeType, const entry_ref* ref,
|
|||||||
docRef = &_docRef;
|
docRef = &_docRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 otherAppFlags = B_REG_DEFAULT_APP_FLAGS;
|
||||||
|
uint32 appFlags = B_REG_DEFAULT_APP_FLAGS;
|
||||||
|
bool alreadyRunning = false;
|
||||||
|
bool wasDocument = true;
|
||||||
|
status_t error = B_OK;
|
||||||
|
ArgVector argVector;
|
||||||
|
team_id team = -1;
|
||||||
|
|
||||||
|
do {
|
||||||
// find the app
|
// find the app
|
||||||
entry_ref appRef;
|
entry_ref appRef;
|
||||||
char signature[B_MIME_TYPE_LENGTH];
|
char signature[B_MIME_TYPE_LENGTH];
|
||||||
uint32 appFlags = B_REG_DEFAULT_APP_FLAGS;
|
|
||||||
bool wasDocument = true;
|
|
||||||
status_t error = _ResolveApp(mimeType, docRef, &appRef, signature,
|
status_t error = _ResolveApp(mimeType, docRef, &appRef, signature,
|
||||||
&appFlags, &wasDocument);
|
&appFlags, &wasDocument);
|
||||||
DBG(OUT(" find app: %s (%lx)\n", strerror(error), error));
|
DBG(OUT(" find app: %s (%lx)\n", strerror(error), error));
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
// build an argument vector
|
// build an argument vector
|
||||||
ArgVector argVector;
|
|
||||||
if (error == B_OK) {
|
|
||||||
error = argVector.Init(argc, args, &appRef,
|
error = argVector.Init(argc, args, &appRef,
|
||||||
(wasDocument ? docRef : NULL));
|
wasDocument ? docRef : NULL);
|
||||||
}
|
|
||||||
DBG(OUT(" build argv: %s (%lx)\n", strerror(error), error));
|
DBG(OUT(" build argv: %s (%lx)\n", strerror(error), error));
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
// pre-register the app (but ignore scipts)
|
// pre-register the app (but ignore scipts)
|
||||||
|
uint32 appToken = 0;
|
||||||
app_info appInfo;
|
app_info appInfo;
|
||||||
bool isScript = wasDocument && docRef != NULL && *docRef == appRef;
|
bool isScript = wasDocument && docRef != NULL && *docRef == appRef;
|
||||||
bool alreadyRunning = false;
|
if (!isScript) {
|
||||||
uint32 appToken = 0;
|
|
||||||
team_id team = -1;
|
|
||||||
uint32 otherAppFlags = B_REG_DEFAULT_APP_FLAGS;
|
|
||||||
if (error == B_OK && !isScript) {
|
|
||||||
error = _AddApplication(signature, &appRef, appFlags, -1, -1, -1, false,
|
error = _AddApplication(signature, &appRef, appFlags, -1, -1, -1, false,
|
||||||
&appToken, &team);
|
&appToken, &team);
|
||||||
if (error == B_ALREADY_RUNNING) {
|
if (error == B_ALREADY_RUNNING) {
|
||||||
@ -2334,12 +2339,16 @@ BRoster::_LaunchApp(const char* mimeType, const entry_ref* ref,
|
|||||||
|
|
||||||
if (appType.InitCheck() == B_OK
|
if (appType.InitCheck() == B_OK
|
||||||
&& appType.GetAppHint(&hintRef) == B_OK
|
&& appType.GetAppHint(&hintRef) == B_OK
|
||||||
&& appRef == hintRef)
|
&& appRef == hintRef) {
|
||||||
appType.SetAppHint(NULL);
|
appType.SetAppHint(NULL);
|
||||||
|
// try again
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} while (false);
|
||||||
|
|
||||||
if (alreadyRunning && current_team() == team) {
|
if (alreadyRunning && current_team() == team) {
|
||||||
// The target team is calling us, so we don't send it the message
|
// The target team is calling us, so we don't send it the message
|
||||||
@ -2443,9 +2452,10 @@ BRoster::_ResolveApp(const char* inType, entry_ref* ref,
|
|||||||
entry_ref appRef;
|
entry_ref appRef;
|
||||||
status_t error;
|
status_t error;
|
||||||
|
|
||||||
if (inType)
|
if (inType) {
|
||||||
error = _TranslateType(inType, &appMeta, &appRef, &appFile);
|
error = _TranslateType(inType, &appMeta, &appRef, &appFile);
|
||||||
else {
|
*_wasDocument = !(appMeta == inType);
|
||||||
|
} else {
|
||||||
error = _TranslateRef(ref, &appMeta, &appRef, &appFile,
|
error = _TranslateRef(ref, &appMeta, &appRef, &appFile,
|
||||||
_wasDocument);
|
_wasDocument);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user