digitalmars.D.bugs - [Issue 19756] New: Add extended attributes support to std.file
- d-bugmail puremagic.com (36/36) Mar 20 2019 https://issues.dlang.org/show_bug.cgi?id=19756
https://issues.dlang.org/show_bug.cgi?id=19756 Issue ID: 19756 Summary: Add extended attributes support to std.file Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P4 Component: phobos Assignee: nobody puremagic.com Reporter: dlang-bugzilla thecybershadow.net Many operating systems and filesystems support adding short, arbitrarily-named attributes to files. The way this is done is OS-specific. std.file should provide a cross-platform interface to set, query, enumerate, and remove these attributes. The following supported OSes support extended attributes: - Linux (getxattr family of functions, already in Druntime) - FreeBSD (VOP_GETEXTATTR family) - OSX (getxattr but a different API) - Windows apparently supports extended attributes in FAT, HPFS, and NTFS. I found some sample PowerShell code to access them here: https://gist.github.com/jaredcatkinson/f1cd44a8605e05c2661bdeca558c03e1 However, it seems to be using kernel mode APIs and I'm not sure how that's done from userspace. More research is needed. Windows seems to have a protected "$Kernel." namespace which is similar to the "system." namespace in the Linux kernel. Note that alternate data streams (a different feature present in some filesystems) is occasionally used for metadata on Windows, see e.g. "Zone.Identifier" which is used to control whether to prompt users when opening files downloaded from the Internet. I have an implementation of a D wrapper around the Linux APIs here: https://github.com/cybershadow/ae/blob/master/sys/file.d (search for XAttr) The interface should be suitable for other platforms as well. --
Mar 20 2019