googledrive
googledrive copied to clipboard
Should ?drive_upload:overwrite mention drive_put?
I am trying to write a script that saves a plot to drive; of course with plots, small tweaks are part & parcel of the job.
That means drive_upload()
is probably inappropriate for my use case, though I'm accustomed to using it as my default go-to function so I'm most used to it.
Thus my journey to discovering drive_put()
:
- Use
drive_upload()
[implicitly using theoverwrite=NA
default]. Oh crap, the re-run just created a new file with the same! Is there anoverwrite
parameter I should be using? - Glance at
?drive_upload
. Yes! OK Let's tryoverwrite=TRUE
. - Looks good! Let's share this file. [Add the right permissions]. Oh crap, the re-run creates a new drive ID... which means the permissions I so painstakingly added were lost! Is that expected behavior?
- [Actually read
overwrite
carefully this time]. Oh, that's unfortunate... do I have to wait until the plot is finalized to set the permissions, then, to avoid this toil? That's unfortunate. Is it not possible to transfer the permissions over? - [Check the Google Drive API... Check the {googledrive} issue tracker... Happen to see
drive_update()
mentioned for the first time] Oh, I guess I should be usingdrive_update()
... but what about the initial upload? Oh,?drive_update()
mentionsdrive_put()
.
I've only just now noticed that drive_put()
is mentioned at the top of ?drive_upload
, oops :)
All this to say, is there any downside to adding another mention of drive_update()
and/or drive_put()
under the description of overwrite
?
https://github.com/tidyverse/googledrive/blob/74a69a3a1fd66e930802ce6e461538c9e15f7c86/man-roxygen/overwrite.R#L8-L12
e.g.
...Note that the new file does not inherit any properties from the old one, such as sharing or publishing settings. It will have a new file ID. If you need to keep permissions and the file ID, use [drive_update()] or [drive_put()]. An error is thrown if two or more pre-existing files are found.
Another thought: It might help beginners to see drive_update()
/drive_put()
mentioned in this output too?
https://github.com/tidyverse/googledrive/blob/74a69a3a1fd66e930802ce6e461538c9e15f7c86/R/utils-paths.R#L59-L61