BRoster::Launch() no longer replace B_NOT_AN_EXECUTABLE with B_LAUNCH_FAILED_EXECUTABLE
for everything - they now do that only for document files.
Also, I extended _TranslateRef() to not report anything that has the executable bit
set as executable - it now only does this if the BEOS:TYPE attribute says it's an
executable.
This fixes the error message Tracker was giving when trying to launch a shared library
("This file was mistakenly set as executable...").
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17023 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+16
-10
@@ -1809,7 +1809,7 @@ BRoster::_LaunchApp(const char *mimeType, const entry_ref *ref,
|
|||||||
error = get_thread_info(appThread, &threadInfo);
|
error = get_thread_info(appThread, &threadInfo);
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
team = threadInfo.team;
|
team = threadInfo.team;
|
||||||
} else if (appThread == B_NOT_AN_EXECUTABLE) {
|
} else if (wasDocument) {
|
||||||
error = B_LAUNCH_FAILED_EXECUTABLE;
|
error = B_LAUNCH_FAILED_EXECUTABLE;
|
||||||
} else
|
} else
|
||||||
error = appThread;
|
error = appThread;
|
||||||
@@ -2024,8 +2024,7 @@ BRoster::_ResolveApp(const char *inType, entry_ref *ref,
|
|||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
BRoster::_TranslateRef(entry_ref *ref, BMimeType *appMeta,
|
BRoster::_TranslateRef(entry_ref *ref, BMimeType *appMeta,
|
||||||
entry_ref *appRef, BFile *appFile,
|
entry_ref *appRef, BFile *appFile, bool *_wasDocument) const
|
||||||
bool *wasDocument) const
|
|
||||||
{
|
{
|
||||||
if (ref == NULL || appMeta == NULL || appRef == NULL || appFile == NULL)
|
if (ref == NULL || appMeta == NULL || appRef == NULL || appFile == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -2055,21 +2054,28 @@ BRoster::_TranslateRef(entry_ref *ref, BMimeType *appMeta,
|
|||||||
// node is executable and a file -- we're done
|
// node is executable and a file -- we're done
|
||||||
*appRef = *ref;
|
*appRef = *ref;
|
||||||
error = appFile->SetTo(appRef, B_READ_ONLY);
|
error = appFile->SetTo(appRef, B_READ_ONLY);
|
||||||
if (wasDocument)
|
|
||||||
*wasDocument = false;
|
|
||||||
// get the app's signature via a BAppFileInfo
|
// get the app's signature via a BAppFileInfo
|
||||||
BAppFileInfo appFileInfo;
|
BAppFileInfo appFileInfo;
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = appFileInfo.SetTo(appFile);
|
error = appFileInfo.SetTo(appFile);
|
||||||
char signature[B_MIME_TYPE_LENGTH];
|
|
||||||
|
char type[B_MIME_TYPE_LENGTH];
|
||||||
|
bool isDocument = true;
|
||||||
|
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
// don't worry, if the file doesn't have a signature, just
|
// don't worry, if the file doesn't have a signature, just
|
||||||
// unset the supplied object
|
// unset the supplied object
|
||||||
if (appFileInfo.GetSignature(signature) == B_OK)
|
if (appFileInfo.GetSignature(type) == B_OK)
|
||||||
error = appMeta->SetTo(signature);
|
error = appMeta->SetTo(type);
|
||||||
else
|
else
|
||||||
appMeta->Unset();
|
appMeta->Unset();
|
||||||
|
if (appFileInfo.GetType(type) == B_OK
|
||||||
|
&& !strcasecmp(type, B_APP_MIME_TYPE))
|
||||||
|
isDocument = false;
|
||||||
}
|
}
|
||||||
|
if (_wasDocument)
|
||||||
|
*_wasDocument = isDocument;
|
||||||
} else {
|
} else {
|
||||||
// the node is not exectuable or not a file
|
// the node is not exectuable or not a file
|
||||||
// init a node info
|
// init a node info
|
||||||
@@ -2096,8 +2102,8 @@ BRoster::_TranslateRef(entry_ref *ref, BMimeType *appMeta,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wasDocument)
|
if (_wasDocument)
|
||||||
*wasDocument = true;
|
*_wasDocument = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
|
|||||||
Reference in New Issue
Block a user