From 1130b709ac27b9c775e86d431011c8ca7b94df5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 4 Jan 2007 23:04:20 +0000 Subject: [PATCH] Tracker now uses the name of the symlink for add-ons, instead of resolving it first. This fixes bug #602. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19704 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/ContainerWindow.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index 7e195d41f9..668ee1dbe3 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -179,9 +179,10 @@ MatchOne(const Model *model, void *castToName) uint32 dummy; StripShortcut(model, buffer, dummy); - if (strcmp(buffer, (const char *)castToName) == 0) + if (strcmp(buffer, (const char *)castToName) == 0) { // found match, bail out return model; + } return 0; } @@ -2720,23 +2721,25 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, dir.Rewind(); while (dir.GetNextEntry(&entry) == B_OK) { - bool primary = false; - - if (entry.IsSymLink()) { - // resolve symlinks if needed - entry_ref ref; - entry.GetRef(&ref); - entry.SetTo(&ref, true); - } - Model *model = new Model(&entry); - if (model->InitCheck() != B_OK || !model->IsExecutable()) { + + if (model->InitCheck() == B_OK && model->IsSymLink()) { + // resolve symlinks + Model* resolved = new Model(model->EntryRef(), true, true); + if (resolved->InitCheck() == B_OK) + model->SetLinkTo(resolved); + else + delete resolved; + } + if (model->InitCheck() != B_OK || !model->ResolveIfLink()->IsExecutable()) { delete model; continue; } // check if it supports at least one of the selected entries + bool primary = false; + if (mimeTypes.CountItems()) { BFile file(&entry, B_READ_ONLY); if (file.InitCheck() == B_OK) {