ropensci / osfr

R interface to the Open Science Framework (OSF)
https://docs.ropensci.org/osfr
Other
143 stars 28 forks source link

No overwrite when making new directory #110

Closed tpyork closed 4 years ago

tpyork commented 4 years ago

osf_mkdir does not overwrite directory if it already exists. This is a good thing. Possibly include message that indicates directory already exists and no action is taken.

project <- osf_create_project("Flower Data")   # create test project
data_dir <- osf_mkdir(project, "data")               # make initial directory
data_dir <- osf_mkdir(project, "data")               # attempt to overwrite directory
aaronwolen commented 4 years ago

Good find.

Originally I thought we should be consistent with dir.create(), which throws a warning when attempting to create a directory that already exists but I almost always set showWarnings=FALSE in my scripts to avoid the extra noise.

Jim Hester must have felt similarly because fs::dir_create() just ignores existing directories.

I agree we should either print a message or document the fact that existing directories are silently ignored (a la fs).

Thoughts?

tpyork commented 4 years ago

great point re fs::dir_create. i'm ok with documenting existing directories are silently ignored.