mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Populate image/gallery title during scan (#1359)
This commit is contained in:
@@ -283,3 +283,14 @@ func IsPathInDir(dir, pathToCheck string) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// GetNameFromPath returns the name of a file from its path
|
||||
// if stripExtension is true the extension is omitted from the name
|
||||
func GetNameFromPath(path string, stripExtension bool) string {
|
||||
fn := filepath.Base(path)
|
||||
if stripExtension {
|
||||
ext := filepath.Ext(fn)
|
||||
fn = strings.TrimSuffix(fn, ext)
|
||||
}
|
||||
return fn
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user