BRoster: preserve symlink as "app" if given one

Symlink name or attributes may be relevant to the launched app, so it's
important that we pass the unresolved symlink as argv[0] when running
it.

Change-Id: Ie1d73bc4e9d5c3d0476f205ce635aafd9203e553
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1739
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Adrien Destugues
2019-08-24 16:28:45 +00:00
committed by waddlesplash
parent 6faf979da7
commit 4eaa1f35e5
+5 -1
View File
@@ -2194,6 +2194,8 @@ BRoster::_TranslateRef(entry_ref* ref, BMimeType* appMeta,
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;
entry_ref originalRef = *ref;
// resolve ref, if necessary // resolve ref, if necessary
BEntry entry; BEntry entry;
status_t error = entry.SetTo(ref, false); status_t error = entry.SetTo(ref, false);
@@ -2254,7 +2256,9 @@ BRoster::_TranslateRef(entry_ref* ref, BMimeType* appMeta,
// we're done. // we're done.
char preferredApp[B_MIME_TYPE_LENGTH]; char preferredApp[B_MIME_TYPE_LENGTH];
if (!isDocument || appFileInfo.GetPreferredApp(preferredApp) != B_OK) { if (!isDocument || appFileInfo.GetPreferredApp(preferredApp) != B_OK) {
*appRef = *ref; // If we were given a symlink, point appRef to it in case its name
// or attributes are relevant.
*appRef = originalRef;
if (_wasDocument != NULL) if (_wasDocument != NULL)
*_wasDocument = isDocument; *_wasDocument = isDocument;