* LaunchApp() now removes an existing app hint if load_image() returned an

error. It could even try again in the case of launch-by-signature to make
  it more robust.
* _ResolveApp() now only updates the MIME type's app hint if there is no hint
  already. This means that only the first app launch will update the hint, not
  the ones after that; ie. if you had two installations of an app, launching
  it by signature will now always launch the first app, not the one started
  last.
* This is done since the app hint is written before its known whether or not
  the app could be started at all. Now, if an app could not be started, the
  hint is removed, which means it can be reset on next try.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38368 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-08-26 12:13:45 +00:00
parent 303269dc22
commit d3e85ecc1a

View File

@ -2323,8 +2323,20 @@ BRoster::_LaunchApp(const char* mimeType, const entry_ref* ref,
if (error != B_OK) {
if (appThread >= 0)
kill_thread(appThread);
if (!isScript)
if (!isScript) {
_RemovePreRegApp(appToken);
if (!wasDocument) {
// Remove app hint if it's this one
BMimeType appType(signature);
entry_ref hintRef;
if (appType.InitCheck() == B_OK
&& appType.GetAppHint(&hintRef) == B_OK
&& appRef == hintRef)
appType.SetAppHint(NULL);
}
}
}
}
@ -2451,9 +2463,12 @@ BRoster::_ResolveApp(const char* inType, entry_ref* ref,
char signature[B_MIME_TYPE_LENGTH];
if (appFileInfo.SetTo(&appFile) == B_OK
&& appFileInfo.GetSignature(signature) == B_OK) {
if (!strcasecmp(appMeta.Type(), signature))
appMeta.SetAppHint(&appRef);
else {
if (!strcasecmp(appMeta.Type(), signature)) {
// Only set the app hint if there is none yet
entry_ref dummyRef;
if (appMeta.GetAppHint(&dummyRef) != B_OK)
appMeta.SetAppHint(&appRef);
} else {
appMeta.SetAppHint(NULL);
appMeta.SetTo(signature);
}