basicfs_fileinfo_unix.go 623 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (C) 2017 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 basicFileInfo) Mode() FileMode {
  10. return FileMode(e.FileInfo.Mode())
  11. }
  12. func (e basicFileInfo) Owner() int {
  13. if st, ok := e.Sys().(*syscall.Stat_t); ok {
  14. return int(st.Uid)
  15. }
  16. return -1
  17. }
  18. func (e basicFileInfo) Group() int {
  19. if st, ok := e.Sys().(*syscall.Stat_t); ok {
  20. return int(st.Gid)
  21. }
  22. return -1
  23. }