diff --git a/R/outpack_config.R b/R/outpack_config.R index 01da4f76..e15115b3 100644 --- a/R/outpack_config.R +++ b/R/outpack_config.R @@ -187,7 +187,7 @@ config_set_path_archive <- function(value, root) { path_archive_old <- file.path(root$path, config$core$path_archive) if (fs::dir_exists(path_archive_old)) { path_archive_new <- file.path(root$path, value) - assert_relative_path(value, name = "path_archive", workdir = root$path) + assert_relative_path(value, name = "'path_archive'", workdir = root$path) assert_directory_does_not_exist(path_archive_new) fs::dir_copy(path_archive_old, path_archive_new) fs::dir_delete(path_archive_old) @@ -195,7 +195,7 @@ config_set_path_archive <- function(value, root) { config$core$path_archive <- value } else { path_archive <- file.path(root$path, value) - assert_relative_path(value, name = "path_archive", workdir = root$path) + assert_relative_path(value, name = "'path_archive'", workdir = root$path) assert_directory_does_not_exist(path_archive) tryCatch({ fs::dir_create(path_archive) diff --git a/R/util_assert.R b/R/util_assert.R index acb0e4e3..28372ea2 100644 --- a/R/util_assert.R +++ b/R/util_assert.R @@ -109,7 +109,7 @@ assert_relative_path <- function(files, name, workdir, call = NULL) { n <- cli::qty(sum(err)) ## TODO: try and relativise - use path_has_parent and path_rel cli::cli_abort( - c("{name}{n}{?s} must be relative path{?s}", + c("{name}{n}{?s} must be {?a/} relative path{?s}", set_names(files[err], "x"), i = "Path was relative to directory '{workdir}'"), call = call) diff --git a/tests/testthat/test-outpack-config.R b/tests/testthat/test-outpack-config.R index 68a0fa5a..e94524f5 100644 --- a/tests/testthat/test-outpack-config.R +++ b/tests/testthat/test-outpack-config.R @@ -271,7 +271,7 @@ test_that("Archive is not added if file store is corrupt", { test_that("Validates path_archive", { root <- create_temporary_root(path_archive = NULL, use_file_store = TRUE) expect_error(orderly_config_set(core.path_archive = "/archive", root = root), - "'path_archive' must be relative path") + "'path_archive' must be a relative path") expect_null(root$config$core$path_archive) dir.create(file.path(root$path, "archive")) @@ -281,7 +281,7 @@ test_that("Validates path_archive", { orderly_config_set(core.path_archive = "new-archive", root = root) expect_error(orderly_config_set(core.path_archive = "/archive", root = root), - "'path_archive' must be relative path") + "'path_archive' must be a relative path") expect_error(orderly_config_set(core.path_archive = "archive", root = root), "Directory already exists") expect_equal(root$config$core$path_archive, "new-archive") diff --git a/tests/testthat/test-util-assert.R b/tests/testthat/test-util-assert.R index 28faabb0..317905c2 100644 --- a/tests/testthat/test-util-assert.R +++ b/tests/testthat/test-util-assert.R @@ -108,7 +108,7 @@ test_that("assert_is_directory", { test_that("assert_relative_path", { workdir <- getwd() expect_error(assert_relative_path(getwd(), "File", workdir), - "File must be relative path", + "File must be a relative path", fixed = TRUE) expect_silent(assert_relative_path("relpath", "File", workdir)) expect_silent(assert_relative_path("a/b/c", "File", workdir))