xAttrs

Return XAttrs for the given open file.

  1. auto xAttrs(string path)
  2. auto xAttrs(File f)
    version(linux)
    xAttrs
    (
    ref const File f
    )

Examples

if (!xAttrs(".").supported)
{
	import std.stdio : stderr;
	stderr.writeln("ae.sys.file: xattrs not supported on current filesystem, skipping test.");
	return;
}

enum fn = "test.txt";
std.file.write(fn, "test");
scope(exit) remove(fn);

auto attrs = xAttrs(fn);
enum key = "user.foo";
assert(key !in attrs);
assertThrown!ErrnoException(attrs[key]);
assert(attrs.keys == []);

attrs[key] = "bar";
assert(key in attrs);
assert(attrs[key] == "bar");
assert(attrs.keys == [key]);

attrs.remove(key);
assert(key !in attrs);
assert(attrs.keys == []);

Meta