MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / pluginIDFromPath

Function pluginIDFromPath

internal/pluginhost/platform.go:47–60  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

45}
46
47func pluginIDFromPath(path string) string {
48 file, ok := pluginFileFromPath(path, "")
49 if ok {
50 return file.ID
51 }
52 base := filepath.Base(path)
53 lowerBase := strings.ToLower(base)
54 for _, extension := range []string{".so", ".dylib", ".dll"} {
55 if strings.HasSuffix(lowerBase, extension) {
56 return base[:len(base)-len(extension)]
57 }
58 }
59 return base
60}
61
62func pluginFileFromPath(filePath string, requiredExtension string) (pluginFile, bool) {
63 base := filepath.Base(filePath)

Callers 1

Calls 1

pluginFileFromPathFunction · 0.70

Tested by 1