[Issue 19756] Add extended attributes support to std.file

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 20 14:44:48 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19756

Richard Cattermole <alphaglosined at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alphaglosined at gmail.com

--- Comment #1 from Richard Cattermole <alphaglosined at gmail.com> ---
I found out a few details for Windows.

To list all extended attributes use FindFirstStreamW and FindNextStreamW
providing the file name.

To read or write attributes, use standard file IO functions but use the file
name in the format of: "filename:attribute:$DATA". Note that ":$DATA" will be
appended if gotten from e.g. FindFirstStreamW.

DigitalMars libc will not work for interacting with the attributes. But MSVC's
will. I would recommend using WriteFile and ReadFile from WinAPI instead of
using the libc abstraction.

To delete an attribute you can use CreateFileW (on close). Note: if you delete
the stream "filename::$DATA" the file will be deleted.

We also need to create fileapi.h as part of the Windows bindings. Its missing
and contains the two main functions with their related declarations.

While we are at it, it might be a good idea to extend std.mmap to be able to
use these attributes as a source of a file (if possible).

--


More information about the Digitalmars-d-bugs mailing list