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

Function comparePluginVersions

internal/pluginhost/platform.go:218–239  ·  view source on GitHub ↗
(a, b string)

Source from the content-addressed store, hash-verified

216}
217
218func comparePluginVersions(a, b string) (int, bool) {
219 segmentsA := strings.Split(a, ".")
220 segmentsB := strings.Split(b, ".")
221 length := len(segmentsA)
222 if len(segmentsB) > length {
223 length = len(segmentsB)
224 }
225 for index := 0; index < length; index++ {
226 numberA, okA := pluginVersionSegment(segmentsA, index)
227 numberB, okB := pluginVersionSegment(segmentsB, index)
228 if !okA || !okB {
229 return 0, false
230 }
231 if numberA != numberB {
232 if numberA < numberB {
233 return -1, true
234 }
235 return 1, true
236 }
237 }
238 return 0, true
239}
240
241func pluginVersionSegment(segments []string, index int) (int64, bool) {
242 if index >= len(segments) {

Callers 1

pluginFilePreferredFunction · 0.85

Calls 1

pluginVersionSegmentFunction · 0.85

Tested by

no test coverage detected