...

Source file src/github.com/in-toto/in-toto-golang/in_toto/util_windows.go

Documentation: github.com/in-toto/in-toto-golang/in_toto

     1  package in_toto
     2  
     3  import (
     4  	"errors"
     5  	"os"
     6  )
     7  
     8  func isWritable(path string) error {
     9  	// get fileInfo
    10  	info, err := os.Stat(path)
    11  	if err != nil {
    12  		return err
    13  	}
    14  
    15  	// check if path is a directory
    16  	if !info.IsDir() {
    17  		return errors.New("not a directory")
    18  	}
    19  
    20  	// Check if the user bit is enabled in file permission
    21  	if info.Mode().Perm()&(1<<(uint(7))) == 0 {
    22  		return errors.New("not writable")
    23  	}
    24  	return nil
    25  }
    26  

View as plain text