mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:23:47 +01:00
cmd/ncdu: display correct path in delete confirmation dialog
If the remote on the command line is "remote:subdir", when deleting "filename", the confirmation message shows the path "remote:subdirfilename". Using fspath.JoinRootPath() fixes this. Also use this function and fs.ConfigString() in other parts of the file, since they are more appropriate.
This commit is contained in:
parent
3a20929db4
commit
0f41e91d41
@ -19,6 +19,7 @@ import (
|
||||
"github.com/rclone/rclone/cmd"
|
||||
"github.com/rclone/rclone/cmd/ncdu/scan"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/fspath"
|
||||
"github.com/rclone/rclone/fs/operations"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@ -529,7 +530,7 @@ func (u *UI) delete() {
|
||||
}
|
||||
u.popupBox([]string{
|
||||
"Delete this file?",
|
||||
u.fsName + dirEntry.String()})
|
||||
fspath.JoinRootPath(u.fsName, dirEntry.String())})
|
||||
} else {
|
||||
u.boxMenuHandler = func(f fs.Fs, p string, o int) (string, error) {
|
||||
if o != 1 {
|
||||
@ -548,7 +549,7 @@ func (u *UI) delete() {
|
||||
u.popupBox([]string{
|
||||
"Purge this directory?",
|
||||
"ALL files in it will be deleted",
|
||||
u.fsName + dirEntry.String()})
|
||||
fspath.JoinRootPath(u.fsName, dirEntry.String())})
|
||||
}
|
||||
}
|
||||
|
||||
@ -659,7 +660,7 @@ func (u *UI) sortCurrentDir() {
|
||||
func (u *UI) setCurrentDir(d *scan.Dir) {
|
||||
u.d = d
|
||||
u.entries = d.Entries()
|
||||
u.path = path.Join(u.fsName, d.Path())
|
||||
u.path = fspath.JoinRootPath(u.fsName, d.Path())
|
||||
u.sortCurrentDir()
|
||||
}
|
||||
|
||||
@ -742,7 +743,7 @@ func NewUI(f fs.Fs) *UI {
|
||||
f: f,
|
||||
path: "Waiting for root...",
|
||||
dirListHeight: 20, // updated in Draw
|
||||
fsName: f.Name() + ":" + f.Root(),
|
||||
fsName: fs.ConfigString(f),
|
||||
showGraph: true,
|
||||
showCounts: false,
|
||||
showDirAverageSize: false,
|
||||
|
Loading…
Reference in New Issue
Block a user