mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 16:06:36 +01:00
--------- Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
23 lines
553 B
Go
23 lines
553 B
Go
package ai
|
|
|
|
import "path"
|
|
|
|
// pickSafeTensorsName implements the documented naming precedence chain:
|
|
func pickSafeTensorsName(nameOrPath, fallbackName string) string {
|
|
if nameOrPath != "" {
|
|
return path.Base(nameOrPath)
|
|
}
|
|
return fallbackName
|
|
}
|
|
|
|
// safeTensorsDirName returns the directory-scan naming fallback: the base name
|
|
// of the group's parent directory (the group key is already that directory).
|
|
func safeTensorsDirName(directory string) string {
|
|
base := path.Base(directory)
|
|
switch base {
|
|
case "/", ".", "":
|
|
return ""
|
|
}
|
|
return base
|
|
}
|