mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-14 06:12:23 +03:00
Support Windows paths
This commit is contained in:
parent
653b5ea9d3
commit
2d1d992e17
@ -96,7 +96,7 @@ func (r mediaFileRepository) FindByPath(path string) (model.MediaFiles, error) {
|
|||||||
// FindPathsRecursively returns a list of all subfolders of basePath, recursively
|
// FindPathsRecursively returns a list of all subfolders of basePath, recursively
|
||||||
func (r mediaFileRepository) FindPathsRecursively(basePath string) ([]string, error) {
|
func (r mediaFileRepository) FindPathsRecursively(basePath string) ([]string, error) {
|
||||||
// Query based on https://stackoverflow.com/a/38330814/653632
|
// Query based on https://stackoverflow.com/a/38330814/653632
|
||||||
sel := r.newSelect().Columns("distinct rtrim(path, replace(path, '/', ''))").
|
sel := r.newSelect().Columns(fmt.Sprintf("distinct rtrim(path, replace(path, '%s', ''))", string(os.PathSeparator))).
|
||||||
Where(Like{"path": filepath.Join(basePath, "%")})
|
Where(Like{"path": filepath.Join(basePath, "%")})
|
||||||
var res []string
|
var res []string
|
||||||
err := r.queryAll(sel, &res)
|
err := r.queryAll(sel, &res)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user