From 23a6a63e832c284467e36a0026c18234759dd1fa Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 19 Aug 2016 11:09:02 -0700 Subject: [PATCH] Keymap: Follow symlink get_ref_for_path() doesn't resolve symlinks. Construct a BEntry from the path passing 'true' for the traverse argument. That BEntry is then be passed to BDirectory's constructor. The error was hidden by the fact that the code didn't bother to error check the result of get_ref_for_path(), which would have indicated that the passed in path was a link. Thanks Rene for your help. if the entry fails to init, we are probably screwed, but, try to get the path using get_ref_for_path in that case. Worst case scenario it fails as well and the FilePanel points to your home directory. --- src/preferences/keymap/KeymapWindow.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/preferences/keymap/KeymapWindow.cpp b/src/preferences/keymap/KeymapWindow.cpp index 3d6bd9ddb7..b25fa9d2e8 100644 --- a/src/preferences/keymap/KeymapWindow.cpp +++ b/src/preferences/keymap/KeymapWindow.cpp @@ -133,14 +133,16 @@ KeymapWindow::KeymapWindow() path.Append("Keymap"); entry_ref ref; - get_ref_for_path(path.Path(), &ref); - - BDirectory userKeymapsDir(&ref); + BEntry entry(path.Path(), true); // follow symlink + BDirectory userKeymapsDir(&entry); if (userKeymapsDir.InitCheck() != B_OK && create_directory(path.Path(), S_IRWXU | S_IRWXG | S_IRWXO) == B_OK) { get_ref_for_path(path.Path(), &ref); - } + } else if (entry.InitCheck() == B_OK) + entry.GetRef(&ref); + else + get_ref_for_path(path.Path(), &ref); BMessenger messenger(this); fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messenger, &ref,