Skip to content

If dst already exists, it will be not overwritten when calling CopyToRemote(), just opposite to the comments. #89

@BillWangCS

Description

@BillWangCS

I found "CopyToRemote()" will call Create, and get an error return telling that the file is already exist, I recommand to add a function 'CreateAnyway()', it will firstly remove the existed file, and create a new for operating. We can call it in "CopyToRemote()" instead of calling "Create()"

func (c *Client) CreateAnyway(name string) (*FileWriter, error) {
_, err := c.getFileInfo(name)
if err == nil {
if err = c.Remove(name); err != nil {
return nil, err
}
} else if !os.IsNotExist(err) {
return nil, &os.PathError{"createAnyway", name, err}
}
defaults, err := c.fetchDefaults()
if err != nil {
return nil, err
}
replication := int(defaults.GetReplication())
blockSize := int64(defaults.GetBlockSize())
return c.CreateFile(name, replication, blockSize, 0644)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions