Path.chown

void chown(int uid, int gid) const

Changes the file's owner user ID and/or group ID.

Platform semantics:

  • POSIX: Uses chown(2) which follows symlinks (acts on the target).
  • Windows: Not supported; this method throws an exception.

Parameters

uidNew user ID. Pass a negative value to leave unchanged (mapped to (uid_t)-1 where supported).
gidNew group ID. Pass a negative value to leave unchanged (mapped to (gid_t)-1 where supported).