35 lines
582 B
Plaintext
35 lines
582 B
Plaintext
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
type Instance struct {
|
|
InstanceName string
|
|
ModpackId string
|
|
ModpackVersion string
|
|
}
|
|
|
|
type InstanceManager struct {
|
|
instances []Instance
|
|
PrismLauncher Prism
|
|
ctx context.Context
|
|
}
|
|
|
|
func (i *InstanceManager)SearchInstances() {
|
|
i.instances = []Instance{}
|
|
dir := i.PrismLauncher.GetInstanceDir()
|
|
subdirs, _ := os.ReadDir(dir)
|
|
for _, d := range subdirs {
|
|
if !d.IsDir() {
|
|
continue
|
|
}
|
|
if _, err := os.Stat(filepath.Join(dir, d.Name(), "instance.json")); err != nil {
|
|
continue
|
|
}
|
|
f, _ = os.OpenFile()
|
|
}
|
|
}
|