diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-03-30 18:15:56 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-03-30 18:24:53 +0900 |
| commit | a6600be34ad812ff13c89f45c3cadaac6d994e67 (patch) | |
| tree | 48c8cd6daab8084eb9391c7ee16f2b38f1cf280f /check | |
| parent | b5592633f5b980970808fc5be43b0fb4f4d4e784 (diff) | |
all: use filepath
This makes package check portable, and removes nonportable behaviour from package pkg, pipewire, and system. All other packages remain nonportable due to their nature. No latency increase was observed due to this change on amd64 and arm64 linux.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'check')
| -rw-r--r-- | check/absolute.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/check/absolute.go b/check/absolute.go index d17d5e1a..bf6ed813 100644 --- a/check/absolute.go +++ b/check/absolute.go @@ -5,7 +5,7 @@ import ( "encoding/json" "errors" "fmt" - "path" + "path/filepath" "slices" "strings" "syscall" @@ -61,7 +61,7 @@ func (a *Absolute) Is(v *Absolute) bool { // NewAbs checks pathname and returns a new [Absolute] if pathname is absolute. func NewAbs(pathname string) (*Absolute, error) { - if !path.IsAbs(pathname) { + if !filepath.IsAbs(pathname) { return nil, AbsoluteError(pathname) } return unsafeAbs(pathname), nil @@ -76,13 +76,13 @@ func MustAbs(pathname string) *Absolute { } } -// Append calls [path.Join] with [Absolute] as the first element. +// Append calls [filepath.Join] with [Absolute] as the first element. func (a *Absolute) Append(elem ...string) *Absolute { - return unsafeAbs(path.Join(append([]string{a.String()}, elem...)...)) + return unsafeAbs(filepath.Join(append([]string{a.String()}, elem...)...)) } -// Dir calls [path.Dir] with [Absolute] as its argument. -func (a *Absolute) Dir() *Absolute { return unsafeAbs(path.Dir(a.String())) } +// Dir calls [filepath.Dir] with [Absolute] as its argument. +func (a *Absolute) Dir() *Absolute { return unsafeAbs(filepath.Dir(a.String())) } // GobEncode returns the checked pathname. func (a *Absolute) GobEncode() ([]byte, error) { @@ -92,7 +92,7 @@ func (a *Absolute) GobEncode() ([]byte, error) { // GobDecode stores data if it represents an absolute pathname. func (a *Absolute) GobDecode(data []byte) error { pathname := string(data) - if !path.IsAbs(pathname) { + if !filepath.IsAbs(pathname) { return AbsoluteError(pathname) } a.pathname = unique.Make(pathname) @@ -110,7 +110,7 @@ func (a *Absolute) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, &pathname); err != nil { return err } - if !path.IsAbs(pathname) { + if !filepath.IsAbs(pathname) { return AbsoluteError(pathname) } a.pathname = unique.Make(pathname) |
