A customer reported that the
SHGetKnownFolderPath
function
was not working correctly.
They moved their Videos folder to a new location,
but when they called
SHGetKnownFolderPath
,
they got the old path rather than the new one.
A quick check of the code they provided showed why:
... SHGetKnownFolderPath(FOLDERID_Videos, KF_FLAG_DONT_VERIFY | KF_FLAG_DEFAULT_PATH, NULL, &pszPath);
Um, you’re passing the
KF_FLAG_DEFAULT_PATH
flag.
That flag means
“Tell me where this folder would have been
if its location had never been customized.”
Therefore,
if you pass this flag,
you have no right to complain that it’s returning
a path different from the customized path.
Because passing that flag means “I don’t want
the customized path.”
0 comments