fileinfo_unix.go 537 B

12345678910111213141516171819202122232425
  1. // Copyright (C) 2019 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at https://mozilla.org/MPL/2.0/.
  6. // +build !windows
  7. package fs
  8. import "syscall"
  9. func (e fsFileInfo) Owner() int {
  10. if st, ok := e.Sys().(*syscall.Stat_t); ok {
  11. return int(st.Uid)
  12. }
  13. return -1
  14. }
  15. func (e fsFileInfo) Group() int {
  16. if st, ok := e.Sys().(*syscall.Stat_t); ok {
  17. return int(st.Gid)
  18. }
  19. return -1
  20. }