If a preferred app was manually set but it is not found anymore (say, it was
deleted) try to handle it as if there was no preferred app set and if a handler for its type exists, use it to open the file. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30438 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+15
-2
@@ -2123,6 +2123,8 @@ BRoster::_TranslateRef(entry_ref *ref, BMimeType *appMeta,
|
|||||||
error = B_LAUNCH_FAILED_NO_RESOLVE_LINK;
|
error = B_LAUNCH_FAILED_NO_RESOLVE_LINK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("ref->name = %s\n", ref->name);
|
||||||
|
|
||||||
// init node
|
// init node
|
||||||
BNode node;
|
BNode node;
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
@@ -2168,15 +2170,26 @@ BRoster::_TranslateRef(entry_ref *ref, BMimeType *appMeta,
|
|||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
// if the file has a preferred app, let _TranslateType() find
|
// if the file has a preferred app, let _TranslateType() find
|
||||||
// it for us
|
// it for us
|
||||||
|
bool foundPreferredApp = false;
|
||||||
if (nodeInfo.GetPreferredApp(preferredApp) == B_OK) {
|
if (nodeInfo.GetPreferredApp(preferredApp) == B_OK) {
|
||||||
error = _TranslateType(preferredApp, appMeta, appRef,
|
error = _TranslateType(preferredApp, appMeta, appRef,
|
||||||
appFile);
|
appFile);
|
||||||
} else {
|
if (error == B_OK)
|
||||||
// no preferred app -- we need to get the file's type
|
foundPreferredApp = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundPreferredApp) {
|
||||||
|
// no preferred app or existing one was not found -- we
|
||||||
|
// need to get the file's type
|
||||||
|
|
||||||
|
error = B_OK; // reset error.
|
||||||
|
|
||||||
char fileType[B_MIME_TYPE_LENGTH];
|
char fileType[B_MIME_TYPE_LENGTH];
|
||||||
|
|
||||||
// get the type from the file, or guess a type
|
// get the type from the file, or guess a type
|
||||||
if (nodeInfo.GetType(fileType) != B_OK)
|
if (nodeInfo.GetType(fileType) != B_OK)
|
||||||
error = _SniffFile(ref, &nodeInfo, fileType);
|
error = _SniffFile(ref, &nodeInfo, fileType);
|
||||||
|
|
||||||
// now let _TranslateType() do the actual work
|
// now let _TranslateType() do the actual work
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
error = _TranslateType(fileType, appMeta, appRef,
|
error = _TranslateType(fileType, appMeta, appRef,
|
||||||
|
|||||||
Reference in New Issue
Block a user