mirror of
https://github.com/rclone/rclone.git
synced 2025-01-19 15:02:46 +08:00
Debug directory creation and removal - fixes #1192
This commit is contained in:
parent
70b5b2f5c6
commit
f3c7e1a9dd
|
@ -1061,12 +1061,21 @@ func ListDir(f Fs, w io.Writer) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// logDirName returns an object for the logger
|
||||||
|
func logDirName(f Fs, dir string) interface{} {
|
||||||
|
if dir != "" {
|
||||||
|
return dir
|
||||||
|
}
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
// Mkdir makes a destination directory or container
|
// Mkdir makes a destination directory or container
|
||||||
func Mkdir(f Fs, dir string) error {
|
func Mkdir(f Fs, dir string) error {
|
||||||
if Config.DryRun {
|
if Config.DryRun {
|
||||||
Logf(f, "Not making directory as dry run is set")
|
Logf(logDirName(f, dir), "Not making directory as dry run is set")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Debugf(logDirName(f, dir), "Making directory")
|
||||||
err := f.Mkdir(dir)
|
err := f.Mkdir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Stats.Error()
|
Stats.Error()
|
||||||
|
@ -1079,13 +1088,10 @@ func Mkdir(f Fs, dir string) error {
|
||||||
// count errors but may return one.
|
// count errors but may return one.
|
||||||
func TryRmdir(f Fs, dir string) error {
|
func TryRmdir(f Fs, dir string) error {
|
||||||
if Config.DryRun {
|
if Config.DryRun {
|
||||||
if dir != "" {
|
Logf(logDirName(f, dir), "Not deleting as dry run is set")
|
||||||
Logf(dir, "Not deleting as dry run is set")
|
|
||||||
} else {
|
|
||||||
Logf(f, "Not deleting as dry run is set")
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Debugf(logDirName(f, dir), "Removing directory")
|
||||||
return f.Rmdir(dir)
|
return f.Rmdir(dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user