2026-11-30 04:02:53 +00:00
|
|
|
package artifacts
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strings"
|
|
|
|
|
|
2026-12-03 02:01:48 +00:00
|
|
|
"gitea.maximumdirect.net/eric/narratio/v4/internal/pathsafe"
|
2026-11-30 04:02:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ProductRelativePath derives portable identity without changing configuration.
|
|
|
|
|
// Configuration validation separately enforces the product's flat category.
|
|
|
|
|
func ProductRelativePath(sessionRoot, configured string) (string, error) {
|
|
|
|
|
value := strings.TrimSpace(configured)
|
|
|
|
|
if filepath.IsAbs(value) {
|
|
|
|
|
root, err := filepath.Abs(sessionRoot)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", err
|
|
|
|
|
}
|
|
|
|
|
return pathsafe.SlashRelativeFromRoot(root, value)
|
|
|
|
|
}
|
|
|
|
|
return pathsafe.NormalizeRelativeDestination(filepath.ToSlash(value))
|
|
|
|
|
}
|