Modified RegistryList
This commit is contained in:
parent
5a48f755a2
commit
61effffff4
1 changed files with 13 additions and 11 deletions
|
|
@ -6,10 +6,14 @@ import (
|
|||
"os"
|
||||
)
|
||||
|
||||
type RegistryList struct {
|
||||
Registries []string
|
||||
type RegistryEntries struct{
|
||||
entries map[string]string
|
||||
}
|
||||
|
||||
var(
|
||||
Registry RegistryEntries
|
||||
)
|
||||
|
||||
func CheckIfRegistryFileExists() bool{
|
||||
_, dirErr := os.Stat("data")
|
||||
_, fileErr := os.Stat("data/registry.list")
|
||||
|
|
@ -19,28 +23,26 @@ func CheckIfRegistryFileExists() bool{
|
|||
return true
|
||||
}
|
||||
|
||||
func parseRegistryList() []string{
|
||||
func parseRegistryList() map[string]string{
|
||||
file, err := os.Open("data/registry.list")
|
||||
if err != nil {
|
||||
ErrorLogger.Fatal(err)
|
||||
}
|
||||
|
||||
lines := make([]string, 512)
|
||||
lines := make(map[string]string)
|
||||
scanner := bufio.NewScanner(file)
|
||||
|
||||
i := 0
|
||||
for scanner.Scan() {
|
||||
if scanner.Text()[0] != '#'{
|
||||
lines[i] = scanner.Text()
|
||||
i++
|
||||
//TODO - Implement splitter
|
||||
}
|
||||
}
|
||||
return lines
|
||||
}
|
||||
|
||||
func LoadRegistryList(){
|
||||
if CheckIfRegistryFileExists(){
|
||||
|
||||
registries := parseRegistryList()
|
||||
func LoadRegistryList() {
|
||||
if CheckIfRegistryFileExists() {
|
||||
Registry.entries = parseRegistryList()
|
||||
fmt.Printf(Registry.entries["0"])
|
||||
}
|
||||
}
|
||||
Reference in a new issue