23 lines
630 B
Go
23 lines
630 B
Go
package artifacts
|
|
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"gitea.maximumdirect.net/eric/narratio/internal/pathsafe"
|
|
)
|
|
|
|
// 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))
|
|
}
|