This repository has been archived on 2026-03-18. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
lotus-package-manager/Tools/RegistryList.go
2021-10-31 00:47:42 +02:00

46 lines
No EOL
697 B
Go

package Tools
import (
"bufio"
"fmt"
"os"
)
type RegistryList struct {
Registries []string
}
func CheckIfRegistryFileExists() bool{
_, dirErr := os.Stat("data")
_, fileErr := os.Stat("data/registry.list")
if dirErr != nil || fileErr != nil {
return false
}
return true
}
func parseRegistryList() []string{
file, err := os.Open("data/registry.list")
if err != nil {
ErrorLogger.Fatal(err)
}
lines := make([]string, 512)
scanner := bufio.NewScanner(file)
i := 0
for scanner.Scan() {
if scanner.Text()[0] != '#'{
lines[i] = scanner.Text()
i++
}
}
return lines
}
func LoadRegistryList(){
if CheckIfRegistryFileExists(){
registries := parseRegistryList()
}
}