mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-20 05:26:30 +02:00
28 lines
716 B
Go
28 lines
716 B
Go
package core
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
// ModExtension is the file extension of the mod metadata files
|
|
const ModExtension = ".toml"
|
|
|
|
// ResolveMod returns the path to a mod file from it's name
|
|
func ResolveMod(modName string, flags Flags) string {
|
|
fileName := strings.ToLower(strings.TrimSuffix(modName, ModExtension)) + ModExtension
|
|
return filepath.Join(flags.ModsFolder, fileName)
|
|
}
|
|
|
|
// ResolveIndex returns the path to the index file
|
|
func ResolveIndex(flags Flags) (string, error) {
|
|
pack, err := LoadPack(flags)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
if filepath.IsAbs(pack.Index.File) {
|
|
return pack.Index.File, nil
|
|
}
|
|
return filepath.Join(filepath.Dir(flags.PackFile), pack.Index.File), nil
|
|
}
|
|
|