Completed download implementation for CF export

Added support for importing manual files and rehashing where necessary
Moved cache folder to "local" user folder
Cleaned up messages, saved index after importing
This commit is contained in:
comp500
2022-05-21 03:40:00 +01:00
parent 55f0e4a297
commit f3837af145
4 changed files with 214 additions and 36 deletions

View File

@@ -114,9 +114,7 @@ var exportCmd = &cobra.Command{
for _, mod := range mods {
projectRaw, ok := mod.GetParsedUpdateData("curseforge")
// If the mod has curseforge metadata, add it to cfFileRefs
// TODO: change back to use ok
_ = ok
if false {
if ok {
p := projectRaw.(cfUpdateData)
cfFileRefs = append(cfFileRefs, packinterop.AddonFileReference{
ProjectID: p.ProjectID,
@@ -146,13 +144,11 @@ var exportCmd = &cobra.Command{
for dl := range session.StartDownloads() {
if dl.Error != nil {
// TODO: ensure name is populated
fmt.Printf("Download of %s (%s) failed: %v\n", dl.Mod.Name, dl.Mod.FileName, dl.Error)
continue
}
for warning := range dl.Warnings {
// TODO: get name
fmt.Printf("Download warning: %v\n", warning)
fmt.Printf("Warning for %s (%s): %v\n", dl.Mod.Name, dl.Mod.FileName, warning)
}
path, err := filepath.Rel(filepath.Dir(indexPath), dl.Mod.GetDestFilePath())
@@ -170,6 +166,8 @@ var exportCmd = &cobra.Command{
fmt.Printf("Error copying file %s: %v\n", path, err)
continue
}
fmt.Printf("%s (%s) added to zip\n", dl.Mod.Name, dl.Mod.FileName)
}
err = session.SaveIndex()