Hi Mike,
I have some questions about your comments:
@@ -46,7 +48,8 @@ shpolicy.c \ shv_bg_cmenu.c \ shv_item_cmenu.c \
- systray.c
- systray.c \
- unixTools.c
s/unixTools.c/unix_tools.c/ for consistency
What do you mean? Does s/x/y/ mean that I should change x into y?
Also consistent indentation would be good.
I did that, because the original code had some weird indentation and didn't want to change that where possible. So I kept the weird indentation where applicable. Overall, it gives it a bit a strange look, I agree.
/*For UNIX browsing, we always use the pszDiplayName to RETURN
the chosen path in, thus:*/
if (!lpbi->pszDisplayName)
{
ERR("pszDisplayName must be set for UNIX browsing.\n");
return FALSE;
}
How does this work? Is the pszDisplayName pointing to a preallocated buffer (if so how do you know how big it should be?).
Yes, this is the way MS intended SHBrowseForFolder to work, so I tried to stay consistent:
From
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/pla...:
*pszDisplayName* Address of a buffer to receive the display name of the folder selected by the user. The size of this buffer is assumed to be MAX_PATH characters.
Of course, MAX_PATH might be different from the UNIX max path constant, though I am hoping to get away with that :-). When I copy the resulting path back into pszDisplayName, I truncate at MAX_PATH, just to be sure.
Another solution would be to let the API indeed allocate the buffer, though the user will have to free it, which he might forget more easily, since he didn't do the allocation.
bi->hwndOwner = dialog;
bi->pszDisplayName = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
bi->lpszTitle = "Please choose a directory"; /*FIXME: Get this multilingual*/
Oh, I see. This is a rather unintuitive API design, why not simply return the path or have a char ** out parameter instead of setting the input structure?
See above. Also, in the future, the pszDisplayName could perhaps be use to preselect an entry, or, the way it works in win32, define the root of the dialog.
Robert