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 <waddlesplash@gmail.com>
This commit is contained in:
Adrien Destugues 2019-08-24 15:52:17 +02:00 committed by waddlesplash
parent 6faf979da7
commit 4eaa1f35e5
1 changed files with 5 additions and 1 deletions

View File

@ -2194,6 +2194,8 @@ BRoster::_TranslateRef(entry_ref* ref, BMimeType* appMeta,
if (ref == NULL || appMeta == NULL || appRef == NULL || appFile == NULL)
return B_BAD_VALUE;
entry_ref originalRef = *ref;
// resolve ref, if necessary
BEntry entry;
status_t error = entry.SetTo(ref, false);
@ -2254,7 +2256,9 @@ BRoster::_TranslateRef(entry_ref* ref, BMimeType* appMeta,
// we're done.
char preferredApp[B_MIME_TYPE_LENGTH];
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)
*_wasDocument = isDocument;