Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
//go:build windows
|
|
|
|
package mygo
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
"reflect"
|
|
"unsafe"
|
|
)
|
|
|
|
// statIdentity makes the os package read the file ID its fileStat holds,
|
|
// which it otherwise defers to the first os.SameFile comparison: that one
|
|
// opens the path again and, after a rename and replace, reads the
|
|
// replacement's ID, taking two directories for one.
|
|
//
|
|
// os/types_windows.go orders the fields so the ID follows the path, and
|
|
// clears the path once the ID is read, so clearing it here leaves the ID
|
|
// read for every later comparison. A FileInfo of another kind, from
|
|
// os.Root or File.Stat, holds no fileStat: it IDs the file through a
|
|
// handle, read when it was taken, and is left as it is.
|
|
func statIdentity(info fs.FileInfo) {
|
|
v := reflect.ValueOf(info)
|
|
if v.Kind() != reflect.Pointer || v.IsNil() {
|
|
return
|
|
}
|
|
v = v.Elem()
|
|
if v.Kind() != reflect.Struct {
|
|
return
|
|
}
|
|
path := v.FieldByName("path")
|
|
if !path.IsValid() || path.Kind() != reflect.String || path.Len() == 0 {
|
|
return
|
|
}
|
|
// SameFile with itself reads the ID.
|
|
_ = os.SameFile(info, info)
|
|
// The path of a loaded fileStat is empty; clearing it, the ID read
|
|
// stays.
|
|
field := (*string)(unsafe.Pointer(v.FieldByName("path").UnsafeAddr()))
|
|
*field = ""
|
|
}
|