Skip to content

Commit 1a42353

Browse files
committed
fixes to sync status file
1 parent 81e642d commit 1a42353

5 files changed

+28
-6
lines changed

DESCRIPTION

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Imports:
2727
cli,
2828
DT,
2929
fs,
30+
fst,
3031
joyn (>= 0.1.6.9003),
3132
stats,
3233
knitr,

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export(full_asym_sync_to_right)
1010
export(full_symmetric_sync)
1111
export(partial_symmetric_sync_common_files)
1212
export(partial_update_missing_files_asym_to_right)
13+
export(save_sync_status)
1314
export(search_duplicates)
1415
export(toy_dirs)
1516
export(update_missing_files_asym_to_right)

R/auxiliary_functions.R

+14-5
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,21 @@ search_duplicates <- function(dir_path,
372372

373373
#' Save sync_status file
374374
#' @param dir_path path to directory
375-
#' @return a file storing a summary of the sync_status, saved in XXXXX TBC
376-
#'
375+
#' @return the file is saved in a `_syncdr` subdirectory within the specified directory
376+
#' @examples
377+
#' \dontrun{
378+
#' # Set the directory path
379+
#' e = toy_dirs()
380+
#' left <- e$left
381+
#' # Save the sync status summary in the default format (or specified via options)
382+
#' save_sync_status(dir_path = left)
383+
#' }
384+
#' @export
377385
save_sync_status <- function(dir_path) {
378386

379387
hashes <- hash_files_in_dir(dir_path)
380388
rownames(hashes) <- NULL
381-
hashes$hash <- as.character(hashes$hash)
389+
hashes$hash <- as.character(hashes$hash)
382390

383391
dates <- directory_info(dir_path) |>
384392
fselect(path, modification_time)
@@ -408,7 +416,7 @@ save_sync_status <- function(dir_path) {
408416
ifelse(requireNamespace("data.table", quietly = TRUE),
409417
'csv', 'Rds')
410418
} else {
411-
style_msgs(color = "orange",
419+
style_msgs(color_name = "orange",
412420
text = "{syncdr} Save_format option raised an error")
413421
cli::cli_abort("{.field saving in {format}} format not allowed")
414422
}
@@ -427,7 +435,8 @@ save_sync_status <- function(dir_path) {
427435
path = file_path),
428436
"csv" = fwrite(x = sync_status_table,
429437
file = file_path),
430-
"rds" = saveRDS()
438+
"rds" = saveRDS(object = sync_status_table,
439+
file = file_path)
431440
)
432441

433442

R/syncdr-package.R

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ if (getRversion() >= "2.15.1") {
2727
"is_new_left",
2828
"is_new_right",
2929
"modification_time",
30+
"modified",
31+
"Paths",
3032
"modification_time_left",
3133
"modification_time_right",
3234
"path",

man/save_sync_status.Rd

+10-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)