add per-OS file variants via files.<os>/ directories
This commit is contained in:
+13
-4
@@ -89,10 +89,7 @@ func LoadConfig(path string) (*packageConfig, error) {
|
||||
}
|
||||
|
||||
func SelectTarget(cfg *packageConfig) (string, error) {
|
||||
osKey := runtime.GOOS
|
||||
if osKey == "darwin" {
|
||||
osKey = "macos"
|
||||
}
|
||||
osKey := OSKey()
|
||||
if cfg.disabled[osKey] {
|
||||
return "", ErrTargetDisabled
|
||||
}
|
||||
@@ -105,6 +102,18 @@ func SelectTarget(cfg *packageConfig) (string, error) {
|
||||
return "", fmt.Errorf("missing target for %s and default", osKey)
|
||||
}
|
||||
|
||||
func OSKey() string {
|
||||
osKey := runtime.GOOS
|
||||
if osKey == "darwin" {
|
||||
osKey = "macos"
|
||||
}
|
||||
return osKey
|
||||
}
|
||||
|
||||
func VariantDirName() string {
|
||||
return FilesDirName + "." + OSKey()
|
||||
}
|
||||
|
||||
func ParseIgnore(cfgTbl *lua.LTable) ([]string, error) {
|
||||
ignoreVal := cfgTbl.RawGetString("ignore")
|
||||
if ignoreVal == lua.LNil {
|
||||
|
||||
Reference in New Issue
Block a user