Files
galaxy-game/server/internal/repo/fs/util_unix.go
T
2026-03-07 00:29:06 +03:00

16 lines
481 B
Go

//go:build unix || (js && wasm) || wasip1
package fs
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
}