MCPcopy
hub / github.com/perkeep/perkeep / FileMode

Method FileMode

pkg/schema/schema.go:459–491  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

457}
458
459func (ss *superset) FileMode() os.FileMode {
460 var mode os.FileMode
461 hasPerm := ss.UnixPermission != ""
462 if hasPerm {
463 m64, err := strconv.ParseUint(ss.UnixPermission, 8, 64)
464 if err == nil {
465 mode = mode | os.FileMode(m64)
466 }
467 }
468
469 // TODO: add other types (block, char, etc)
470 switch ss.Type {
471 case TypeDirectory:
472 mode = mode | os.ModeDir
473 case TypeFile:
474 // No extra bit.
475 case TypeSymlink:
476 mode = mode | os.ModeSymlink
477 case TypeFIFO:
478 mode = mode | os.ModeNamedPipe
479 case TypeSocket:
480 mode = mode | os.ModeSocket
481 }
482 if !hasPerm {
483 switch ss.Type {
484 case TypeDirectory:
485 mode |= 0755
486 default:
487 mode |= 0644
488 }
489 }
490 return mode
491}
492
493// MapUid returns the most appropriate mapping from this file's owner
494// to the local machine's owner, trying first a match by name,

Callers

nothing calls this directly

Calls 1

FileModeMethod · 0.45

Tested by

no test coverage detected