mirror of
https://gitee.com/zhangsken/aliyunpan.git
synced 2026-10-16 10:29:42 +08:00
fix local windows path recognize error
This commit is contained in:
@@ -77,7 +77,7 @@ func CmdLocalPwd() cli.Command {
|
||||
// Unix-like system, so just assume Unix
|
||||
lwd = strings.ReplaceAll(lwd, "\\", "/")
|
||||
}
|
||||
fmt.Println(lwd)
|
||||
fmt.Println("本地工作目录: " + lwd)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
@@ -28,13 +28,6 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ()
|
||||
|
||||
const (
|
||||
opLs int = iota
|
||||
opSearch
|
||||
)
|
||||
|
||||
func CmdLocalLs() cli.Command {
|
||||
return cli.Command{
|
||||
Name: "lls",
|
||||
@@ -216,7 +209,7 @@ func renderTable(path string, files []os.FileInfo) {
|
||||
totalSize += file.Size()
|
||||
tb.Append([]string{strconv.Itoa(k + 1), converter.ConvertFileSize(file.Size(), 2), file.ModTime().Format("2006-01-02 15:04:05"), file.Name()})
|
||||
}
|
||||
tb.Append([]string{"", "总大小: " + converter.ConvertFileSize(totalSize, 2), "", fmt.Sprintf("文件总数: %d, 目录总数: %d", fileCount, dirCount)})
|
||||
tb.Append([]string{"", "总: " + converter.ConvertFileSize(totalSize, 2), "", fmt.Sprintf("文件总数: %d, 目录总数: %d", fileCount, dirCount)})
|
||||
|
||||
fmt.Printf("\n本地当前目录: %s\n", path)
|
||||
fmt.Printf("----\n")
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"github.com/tickstep/aliyunpan/library/homedir"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -19,8 +20,8 @@ func getLocalHomeDir() string {
|
||||
|
||||
// localPathJoin 拼接本地路径
|
||||
func localPathJoin(p string) string {
|
||||
p = strings.ReplaceAll(p, "\\", "/")
|
||||
if path.IsAbs(p) {
|
||||
p = path.Clean(strings.ReplaceAll(p, "\\", "/"))
|
||||
if filepath.IsAbs(p) {
|
||||
return p
|
||||
} else if strings.HasPrefix(p, "~") {
|
||||
if d, e := homedir.Expand(p); e == nil {
|
||||
|
||||
Reference in New Issue
Block a user