/
githubmirror
/
rclone
Обзор
Документация
Войти
/
githubmirror
/
rclone
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.69.3
lib/plugin/plugin.go
40 строк
788 B
albertony
build: remove build constraint syntax for go 1.16 and older
18 апр 2024, 17:53
18 апр 2024, 17:53
68bf6aa
Код
Авторство
О чём код?
//go:build (darwin || linux) && !gccgo package plugin import ( "fmt" "os" "path/filepath" "plugin" "strings" ) func init() { dir := os.Getenv("RCLONE_PLUGIN_PATH") if dir == "" { return } // Get file names of plugin dir listing, err := os.ReadDir(dir) if err != nil { fmt.Fprintln(os.Stderr, "Failed to open plugin directory:", err) } // Enumerate file names, load valid plugins for _, file := range listing { // Match name fileName := file.Name() if !strings.HasPrefix(fileName, "librcloneplugin_") { continue } if !strings.HasSuffix(fileName, ".so") { continue } // Try to load plugin _, err := plugin.Open(filepath.Join(dir, fileName)) if err != nil { fmt.Fprintf(os.Stderr, "Failed to load plugin %s: %s\n", fileName, err) } } }