mirror of
https://github.com/rclone/rclone.git
synced 2025-12-12 06:24:14 +01:00
union: create root directories if none exist
This fixes the TestUnion: integration test if the /tmp/union[123] dirs don't exist.
This commit is contained in:
@@ -145,11 +145,16 @@ func (f *Fs) Hashes() hash.Set {
|
|||||||
// Mkdir makes the root directory of the Fs object
|
// Mkdir makes the root directory of the Fs object
|
||||||
func (f *Fs) Mkdir(ctx context.Context, dir string) error {
|
func (f *Fs) Mkdir(ctx context.Context, dir string) error {
|
||||||
upstreams, err := f.create(ctx, dir)
|
upstreams, err := f.create(ctx, dir)
|
||||||
if err == fs.ErrorObjectNotFound && dir != parentDir(dir) {
|
if err == fs.ErrorObjectNotFound {
|
||||||
|
if dir != parentDir(dir) {
|
||||||
if err := f.Mkdir(ctx, parentDir(dir)); err != nil {
|
if err := f.Mkdir(ctx, parentDir(dir)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
upstreams, err = f.create(ctx, dir)
|
upstreams, err = f.create(ctx, dir)
|
||||||
|
} else if dir == "" {
|
||||||
|
// If root dirs not created then create them
|
||||||
|
upstreams, err = f.upstreams, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -818,6 +823,7 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
fs.Debugf(f, "actionPolicy = %T, createPolicy = %T, searchPolicy = %T", f.actionPolicy, f.createPolicy, f.searchPolicy)
|
||||||
var features = (&fs.Features{
|
var features = (&fs.Features{
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
DuplicateFiles: false,
|
DuplicateFiles: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user