mirror of https://github.com/Xhofe/alist
chore: don't and slash prefix just for windows abs path
parent
505b126888
commit
8a0915ffb1
|
@ -11,6 +11,8 @@ import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ActualPath Get the actual path
|
||||||
|
// !!! maybe and \ in the path when use windows local
|
||||||
func ActualPath(account driver.Additional, rawPath string) string {
|
func ActualPath(account driver.Additional, rawPath string) string {
|
||||||
if i, ok := account.(driver.IRootFolderPath); ok {
|
if i, ok := account.(driver.IRootFolderPath); ok {
|
||||||
rawPath = stdpath.Join(i.GetRootFolderPath(), rawPath)
|
rawPath = stdpath.Join(i.GetRootFolderPath(), rawPath)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package utils
|
||||||
import (
|
import (
|
||||||
stdpath "path"
|
stdpath "path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ import (
|
||||||
func StandardizePath(path string) string {
|
func StandardizePath(path string) string {
|
||||||
path = strings.TrimSuffix(path, "/")
|
path = strings.TrimSuffix(path, "/")
|
||||||
// abs path
|
// abs path
|
||||||
if filepath.IsAbs(path) {
|
if filepath.IsAbs(path) && runtime.GOOS == "windows" {
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
// relative path with prefix '..'
|
// relative path with prefix '..'
|
||||||
|
|
Loading…
Reference in New Issue