client io architecture
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
//go:build unix || (js && wasm) || wasip1
|
||||
|
||||
package util
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
// Writable reports whether path is Writable on Windows.
|
||||
//
|
||||
// Semantics:
|
||||
// - for an existing regular file, it tries to open it for writing;
|
||||
// - for an existing directory, it tries to create and remove a temp file inside it;
|
||||
// - for other file types, it returns false with no error.
|
||||
func Writable(filepath string) (bool, error) {
|
||||
return unix.Access(filepath, unix.W_OK) == nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user