From a1aaf80bd039460050573967a5697d75f2ee00b2 Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Tue, 1 Aug 2023 13:38:37 +0100 Subject: [PATCH] Add roxygen headers to functions --- r/R/filesystem.R | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/r/R/filesystem.R b/r/R/filesystem.R index 5078c797b35ab..9930a702fa7e1 100644 --- a/r/R/filesystem.R +++ b/r/R/filesystem.R @@ -684,21 +684,40 @@ read_file_utf8 <- function(file) { res } +#' List files in a file system +#' +#' @param fs A FileSystem object +#' @param path A character vector of one or more paths +#' @param ... Additional arguments passed to [FileSelector$create()] #' @export -fs_ls <- function(fs, path, ...){ +fs_ls <- function(fs, path = ".", ...){ fs$ls(path, ...) } +#' Create a file in a file system +#' +#' @param fs A FileSystem object +#' @param path A character vector of one or more paths +#' @param recursive Create intermediate directories if they do not exist #' @export fs_create_dir <- function(fs, path, recursive = TRUE){ fs$CreateDir(path, recursive = recursive) } +#' Delete a file in a file system +#' +#' @param fs A FileSystem object +#' @param path A character vector of one or more paths #' @export fs_delete_dir <- function(fs, path){ fs$DeleteDir(path) } +#' Copy a file in a file system +#' +#' @param fs A FileSystem object +#' @param src Source path +#' @param dest Destination path #' @export fs_copy_file <- function(fs, src, dest){ fs$CopyFile(src, dest) @@ -715,14 +734,22 @@ fs_open_output_stream <- function(fs, path, append = FALSE){ # TODO: create method close.OutputStream (or whatever object returned from bucket$OpenAppendStream) +#' Delete a file from a file system +#' +#' @param fs A FileSystem object +#' @param path A character vector of one or more paths #' @export -fs_delete_file <- function(fs, paths){ - fs$DeleteFiles(paths) +fs_delete_file <- function(fs, path){ + fs$DeleteFiles(path) } +#' Get file metadata +#' +#' @param fs A FileSystem object +#' @param path A character vector of one or more paths #' @export -fs_get_file_info <- function(fs, paths){ - fs$GetFileInfo(paths) +fs_get_file_info <- function(fs, path){ + fs$GetFileInfo(path) } #' @export @@ -730,6 +757,16 @@ fs_make_path <- function(fs, path){ fs$path(path) } +#' Move or rename a file in a file system +#' +#' Move / rename a file or directory. If the destination exists: +#' * if it is a non-empty directory, an error is returned +#' * otherwise, if it has the same type as the source, it is replaced +#' * otherwise, behavior is unspecified (implementation-dependent). +#' +#' @param fs A FileSystem object +#' @param src Source path +#' @param dest Destination path #' @export fs_move_file <- function(fs, src, dest){ fs$Move(src, dest)