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.
This commit is contained in:
parent
3d2f4db565
commit
23a6a63e83
@ -133,14 +133,16 @@ KeymapWindow::KeymapWindow()
|
|||||||
path.Append("Keymap");
|
path.Append("Keymap");
|
||||||
|
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
get_ref_for_path(path.Path(), &ref);
|
BEntry entry(path.Path(), true); // follow symlink
|
||||||
|
BDirectory userKeymapsDir(&entry);
|
||||||
BDirectory userKeymapsDir(&ref);
|
|
||||||
if (userKeymapsDir.InitCheck() != B_OK
|
if (userKeymapsDir.InitCheck() != B_OK
|
||||||
&& create_directory(path.Path(), S_IRWXU | S_IRWXG | S_IRWXO)
|
&& create_directory(path.Path(), S_IRWXU | S_IRWXG | S_IRWXO)
|
||||||
== B_OK) {
|
== B_OK) {
|
||||||
get_ref_for_path(path.Path(), &ref);
|
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);
|
BMessenger messenger(this);
|
||||||
fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messenger, &ref,
|
fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messenger, &ref,
|
||||||
|
Loading…
Reference in New Issue
Block a user