Add pack-root option (fixes #27)

This commit is contained in:
comp500
2021-06-04 02:10:29 +01:00
parent d6bed7ad4c
commit 8cbe7d4c61
7 changed files with 26 additions and 15 deletions

View File

@@ -187,7 +187,7 @@ func createModFile(modInfo modInfo, fileInfo modFileInfo, index *core.Index) err
},
Update: updateMap,
}
path := modMeta.SetMetaName(modInfo.Slug)
path := modMeta.SetMetaName(modInfo.Slug, *index)
// If the file already exists, this will overwrite it!!!
// TODO: Should this be improved?

View File

@@ -224,7 +224,8 @@ var importCmd = &cobra.Command{
}
// TODO: just use mods-folder directly? does texture pack importing affect this?
ref, err := filepath.Abs(filepath.Join(filepath.Dir(core.ResolveMod(modInfoValue.Slug)), fileInfo.FileName))
modFilePath := core.ResolveMod(modInfoValue.Slug, index)
ref, err := filepath.Abs(filepath.Join(filepath.Dir(modFilePath), fileInfo.FileName))
if err == nil {
referencedModPaths = append(referencedModPaths, ref)
}
@@ -243,9 +244,9 @@ var importCmd = &cobra.Command{
}
successes = 0
indexFolder := filepath.Dir(filepath.Join(filepath.Dir(viper.GetString("pack-file")), filepath.FromSlash(pack.Index.File)))
packRoot := index.GetPackRoot()
for _, v := range filesList {
filePath := filepath.Join(indexFolder, filepath.FromSlash(v.Name()))
filePath := filepath.Join(packRoot, filepath.FromSlash(v.Name()))
filePathAbs, err := filepath.Abs(filePath)
if err == nil {
found := false