mirror of
https://github.com/thomiceli/opengist.git
synced 2025-06-11 13:07:13 +02:00
Add embed Filesystem
This commit is contained in:
@ -1,11 +1,14 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"gopkg.in/yaml.v3"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var OpengistVersion = "0.0.1"
|
||||
@ -105,6 +108,27 @@ func InitLog() {
|
||||
log.Logger = zerolog.New(multi).Level(level).With().Timestamp().Logger()
|
||||
}
|
||||
|
||||
func CheckGitVersion(version string) (bool, error) {
|
||||
versionParts := strings.Split(version, ".")
|
||||
if len(versionParts) < 2 {
|
||||
return false, fmt.Errorf("invalid version string")
|
||||
}
|
||||
major, err := strconv.Atoi(versionParts[0])
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("invalid major version number")
|
||||
}
|
||||
minor, err := strconv.Atoi(versionParts[1])
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("invalid minor version number")
|
||||
}
|
||||
|
||||
// Check if version is prior to 2.20
|
||||
if major < 2 || (major == 2 && minor < 20) {
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func GetHomeDir() string {
|
||||
absolutePath, _ := filepath.Abs(C.OpengistHome)
|
||||
return filepath.Clean(absolutePath)
|
||||
|
Reference in New Issue
Block a user