Pass through optional-disabled on CF import (fixes #93)

This commit is contained in:
comp500
2022-03-07 18:22:29 +00:00
parent 7c387f6c83
commit 3fb350f244
5 changed files with 22 additions and 10 deletions

View File

@@ -162,7 +162,7 @@ func getModIDFromString(mod string) (bool, int, error) {
return false, 0, nil
}
func createModFile(modInfo modInfo, fileInfo modFileInfo, index *core.Index) error {
func createModFile(modInfo modInfo, fileInfo modFileInfo, index *core.Index, optionalDisabled bool) error {
updateMap := make(map[string]map[string]interface{})
var err error
@@ -181,6 +181,14 @@ func createModFile(modInfo modInfo, fileInfo modFileInfo, index *core.Index) err
hash, hashFormat := fileInfo.getBestHash()
var optional *core.ModOption
if optionalDisabled {
optional = &core.ModOption{
Optional: true,
Default: false,
}
}
modMeta := core.Mod{
Name: modInfo.Name,
FileName: fileInfo.FileName,
@@ -190,6 +198,7 @@ func createModFile(modInfo modInfo, fileInfo modFileInfo, index *core.Index) err
HashFormat: hashFormat,
Hash: hash,
},
Option: optional,
Update: updateMap,
}
path := modMeta.SetMetaName(modInfo.Slug, *index)