Skip to content

Commit

Permalink
Use a dribble to define the upload destination path (#780)
Browse files Browse the repository at this point in the history
* Use a dribble to define the upload destination path

* Update NEWS

---------

Co-authored-by: Julia Silge <[email protected]>
  • Loading branch information
gorkang and juliasilge authored Sep 5, 2023
1 parent b962bdb commit e70b02e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

* Added `board_deparse` for `board_url()` (#774).

* Fixed how `board_gdrive()` makes version directories (#780, @gorkang).


# pins 1.2.1

Expand Down
7 changes: 5 additions & 2 deletions R/board_gdrive.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,23 @@ pin_store.pins_board_gdrive <- function(board, name, paths, metadata,
gdrive_mkdir(fs::path(board$dribble$name, name), version)

version_dir <- fs::path(name, version)
version_dir_dribble = googledrive::as_dribble(version_dir)

# Upload metadata
temp_file <- withr::local_tempfile()
yaml::write_yaml(metadata, file = temp_file)
googledrive::drive_upload(
temp_file,
fs::path(board$dribble$path, version_dir, "data.txt")
version_dir_dribble,
"data.txt"
)

# Upload files
for (path in paths) {
googledrive::drive_upload(
path,
fs::path(board$dribble$path, version_dir, fs::path_file(path))
version_dir_dribble,
fs::path_file(path)
)
}

Expand Down

0 comments on commit e70b02e

Please sign in to comment.