Unify analysis product path identity
This commit is contained in:
22
internal/artifacts/product_path.go
Normal file
22
internal/artifacts/product_path.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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))
|
||||
}
|
||||
Reference in New Issue
Block a user