Open squeek502 opened 10 months ago
I'll work on this to get a stab at some more windows tooling.
@matu3ba I've got an implementation mostly complete for retrieving a known path that I'll likely create a PR for soon.
Right now I'm thinking that the more complicated parts should not be supported (KF_FLAG_CREATE
and KF_FLAG_INIT
in particular, which would potentially need to do things like create "Library" folders, init desktop.ini
files, respect various undocumented flags in FolderDescriptions registry entries, etc).
I'll go into more detail in the PR.
I've decided against making a PR for now to allow for (hopefully) developing a more conformant implementation. SHGetKnownFolderPath
has a lot of moving parts, and Zig only really cares about getting the path to the Local App Data directory, so %LOCALAPPDATA%
seems like a decent solution since it's set by the OS. That is, this issue doesn't seem urgent enough to warrant merging in a potentially half-baked SHGetKnownFolderPath
reimplementation just to stop using %LOCALAPPDATA%
.
I've put my mostly-working-but-probably-has-incorrect-corner-cases implementation here with a lot of explanation in the readme:
https://github.com/squeek502/get-known-folder-path
If anyone wants to help out or has ideas about how to go about this sort of thing, it'd be appreciated. It feels like it's nearly there, just a few pieces that need to be figured out.
EDIT: This is currently being worked on here: https://github.com/squeek502/get-known-folder-path
Follow up from https://github.com/ziglang/zig/pull/18091
To avoid a dependency on
shell32.dll
, theSHGetKnownFolderPath
call withinstd.fs.getAppDataDir
was replaced with aLOCALAPPDATA
environment variable lookup. This has the potential to regressgetAppDataDir
behavior for certain setups and it's not foolproof to rely onLOCALAPPDATA
being set.Instead,
SHGetKnownFolderPath
should be reimplemented in Zig without introducing a dependency onshell32
. For this,wine
's implementation would likely be a good reference.Standalone version of the previous implementation using
SHGetKnownFolderPath
(this is ultimately the behavior that the Zig reimplementation is looking to match, but it shouldn't beFOLDERID_LocalAppData
-specific):