[haiku-commits] Re: haiku: hrev50496 - src/preferences/keymap

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: "haiku-commits@xxxxxxxxxxxxx" <haiku-commits@xxxxxxxxxxxxx>
  • Date: Fri, 19 Aug 2016 10:27:54 -0700

On Fri, Aug 19, 2016 at 1:50 AM, Stephan Aßmus <superstippi@xxxxxx> wrote:

you managed to add all this without fixing the one bug that actually existed
in the code. Please revert and copy & paste this (and check that it
compiles, please):


        BDirectory userKeymapsDir(&ref);
 -      if (userKeymapsDir.InitCheck() != B_OK)
 -              create_directory(path.Path(), S_IRWXU | S_IRWXG | S_IRWXO);
+       if (userKeymapsDir.InitCheck() != B_OK
+               && create_directory(path.Path(),
+                       S_IRWXU | S_IRWXG | S_IRWXO) == B_OK) {
+               get_ref_for_path(path.Path(), &ref);
+       }

As described in the previous mails, the bug was that when the directory had
to be created first, "ref" was still uninitialized. But it should point to
the newly created directory. The patch above fixes that, but I only typed it
into the mail.

The rest of the possible errors is handled by the FilePanel.

Thank you for your patience with me on this.

I now understand the bug you are describing but I am trying to fix a
different bug.

I did test my previous code and I thought it worked, but upon further
testing, it does not work in the following case... and neither does
your code.

If the ~/config/settings/Keymap entry is a symlink to another folder
the FilePanel should open pointing to that folder but it does not.

here's what I did to test.

cd ~/config/settings
rmdir Keymap
ln -s ~/Desktop Keymap

open Keymap and select File => Open

expected result:

A file panel should appear with the Desktop folder open

actual result:

A file panel appears with the Home folder open

How do I fix this bug?

Other related posts: