On 1/22/2013 13:48, Alexey Utkin wrote:
One thing on SHGetKnownFolderPath is that you specify KF_FLAG_CREATE
and I'm not sure if that is right because we don't want the JDK
creating the user's directory if it doesn't exist.
That is a corner case. In the latest versions of OS, MS is trying to
follow "lazy" strategy in everything. Nothing is been instantiating
before the first use. But Java needs the home folder.
So, we have the right to request the creation. That is OS solution to
accept or decline the request.
I agree with Alan. Java shouldn't forcibly create the user directory if
it doesn't exist yet. I suggest to pass 0 (zero) as the dwFlags argument
to ::SHGetKnownFolderPath(). The same applies to a call to the
::SHGetFolderPathW(). getHomeFromShell32() may return NULL, so let it do
so if no user directory exists.
--
best regards,
Anthony