Пример #1
0
func GetInstallDir(pluginName, version string) (string, error) {
	allPluginsInstallDir, err := common.GetPluginsInstallDir(pluginName)
	if err != nil {
		return "", err
	}
	pluginDir := path.Join(allPluginsInstallDir, pluginName)
	if version != "" {
		pluginDir = filepath.Join(pluginDir, version)
	} else {
		pluginDir, err = GetLatestInstalledPluginVersionPath(pluginDir)
		if err != nil {
			return "", err
		}
	}
	return pluginDir, nil
}
Пример #2
0
func IsPluginInstalled(pluginName, pluginVersion string) bool {
	pluginsInstallDir, err := common.GetPluginsInstallDir(pluginName)
	if err != nil {
		return false
	}

	thisPluginDir := filepath.Join(pluginsInstallDir, pluginName)
	if !common.DirExists(thisPluginDir) {
		return false
	}

	if pluginVersion != "" {
		pluginJSON := filepath.Join(thisPluginDir, pluginVersion, common.PluginJSONFile)
		if common.FileExists(pluginJSON) {
			return true
		}
		return false
	}
	return true
}