Make import look in more places for packs

Now supports Curse/Twitch instance names
and folders containing minecraftinstance.json or manifest.json
This commit is contained in:
comp500
2019-09-20 01:37:38 +01:00
parent d6076dba5e
commit 8956ec9bcb
5 changed files with 92 additions and 5 deletions

View File

@@ -0,0 +1,25 @@
package curseforge
import (
"errors"
"os"
"path/filepath"
"golang.org/x/sys/windows"
)
func getCurseDir() (string, error) {
path, err := windows.KnownFolderPath(windows.FOLDERID_Documents, 0)
if err != nil {
return "", err
}
curseDir := filepath.Join(path, "Curse")
if _, err := os.Stat(curseDir); err == nil {
return curseDir, nil
}
curseDir = filepath.Join(path, "Twitch")
if _, err := os.Stat(curseDir); err == nil {
return curseDir, nil
}
return "", errors.New("Curse installation directory cannot be found")
}