mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-21 09:28:14 +00:00
- PluginManifest: add platforms field declaring supported OS - validatePackage: accept bundle .hmap with platform-aware binary check - extractPackage: extract only current OS binary, skip others (macOS renames .dylib → .so) - installFromPath/installFromURL: path install keeps source, URL install auto-cleanup - cabi/loader.go + dynamic.go: add linux/darwin build constraints for Windows cross-compile - dynamic_loader_unix/windows: split SO loading with proper build tags - package/build.sh: enable windows/amd64 for homed, add CXX export for arm64 - tryLoadSO: fallback to plugin.dylib on macOS - docs: update PLUGIN_DEV.md for bundle format and install methods
29 lines
442 B
Go
29 lines
442 B
Go
package plugin
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
const (
|
|
soEntry = "plugin.so"
|
|
dllEntry = "plugin.dll"
|
|
luaEntry = "main.lua"
|
|
metaEntry = "plugin.json"
|
|
)
|
|
|
|
func readManifest(dir string) *PluginManifest {
|
|
data, err := os.ReadFile(filepath.Join(dir, metaEntry))
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
var m PluginManifest
|
|
if err := json.Unmarshal(data, &m); err != nil {
|
|
return nil
|
|
}
|
|
return &m
|
|
}
|
|
|
|
var _ = json.Marshal
|