Skip to content

Commit 0d261dd

Browse files
authored
Merge pull request #494 from r-lib/upkeep-2025-04
2 parents 25736d1 + 18861ca commit 0d261dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1387
-743
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@
2525
^src/README\.md$
2626
^MAINTENANCE\.md$
2727
^pkgdown$
28+
^[\.]?air\.toml$
29+
^\.vscode$

.github/workflows/R-CMD-check.yaml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,24 @@ jobs:
2424
matrix:
2525
config:
2626
- {os: macos-latest, r: 'release'}
27-
- {os: macos-13, r: 'devel'}
2827

29-
# Use 3.6 to trigger usage of RTools35
30-
- {os: windows-latest, r: '3.6'}
28+
- {os: windows-latest, r: 'release'}
3129
# use 4.0 or 4.1 to check with rtools40's older compiler
3230
- {os: windows-latest, r: 'oldrel-4'}
33-
- {os: windows-latest, r: 'release'}
3431

35-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
36-
- {os: ubuntu-latest, r: 'release'}
37-
- {os: ubuntu-latest, r: 'oldrel-1'}
38-
- {os: ubuntu-latest, r: 'oldrel-2'}
39-
- {os: ubuntu-latest, r: 'oldrel-3'}
40-
- {os: ubuntu-latest, r: 'oldrel-4'}
41-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release', locale: 'en_US'}
32+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release', locale: 'en_US'}
33+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
34+
- {os: ubuntu-latest, r: 'release'}
35+
- {os: ubuntu-latest, r: 'oldrel-1'}
36+
- {os: ubuntu-latest, r: 'oldrel-2'}
37+
- {os: ubuntu-latest, r: 'oldrel-3'}
38+
- {os: ubuntu-latest, r: 'oldrel-4'}
4239

4340
env:
4441
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
4542
R_KEEP_PKG_SOURCE: yes
4643

4744
steps:
48-
- name: Set locale
49-
if: matrix.config.locale == 'en_US'
50-
run: |
51-
sudo locale-gen en_US
52-
echo "LC_ALL=en_US" >> $GITHUB_ENV
53-
5445
- uses: actions/checkout@v4
5546

5647
- uses: r-lib/actions/setup-pandoc@v2

.github/workflows/test-coverage.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ jobs:
3434
clean = FALSE,
3535
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3636
)
37+
print(cov)
3738
covr::to_cobertura(cov)
3839
shell: Rscript {0}
3940

40-
- uses: codecov/codecov-action@v4
41+
- uses: codecov/codecov-action@v5
4142
with:
4243
# Fail if error if not on PR, or if on PR and token is given
4344
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
44-
file: ./cobertura.xml
45-
plugin: noop
45+
files: ./cobertura.xml
46+
plugins: noop
4647
disable_search: true
4748
token: ${{ secrets.CODECOV_TOKEN }}
4849

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"Posit.air-vscode"
4+
]
5+
}

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"[r]": {
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "Posit.air-vscode"
5+
}
6+
}

DESCRIPTION

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ Authors@R: c(
99
comment = "libuv library"),
1010
person("Joyent, Inc. and other Node contributors", role = "cph",
1111
comment = "libuv library"),
12-
person("Posit Software, PBC", role = c("cph", "fnd"))
12+
person("Posit Software, PBC", role = c("cph", "fnd"),
13+
comment = c(ROR = "03wc8by49"))
1314
)
1415
Description: A cross-platform interface to file system operations, built
1516
on top of the 'libuv' C library.
1617
License: MIT + file LICENSE
1718
URL: https://fs.r-lib.org, https://github.com/r-lib/fs
1819
BugReports: https://github.com/r-lib/fs/issues
1920
Depends:
20-
R (>= 3.6)
21+
R (>= 4.1)
2122
Imports:
2223
methods
2324
Suggests:
@@ -36,6 +37,7 @@ VignetteBuilder:
3637
ByteCompile: true
3738
Config/Needs/website: tidyverse/tidytemplate
3839
Config/testthat/edition: 3
40+
Config/usethis/last-upkeep: 2025-04-23
3941
Copyright: file COPYRIGHTS
4042
Encoding: UTF-8
4143
Language: en-US

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2023
1+
YEAR: 2025
22
COPYRIGHT HOLDER: fs authors

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) 2023 fs authors
3+
Copyright (c) 2025 fs authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

R/copy.R

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ file_copy <- function(path, new_path, overwrite = FALSE) {
5757
if (length(new) == 1 && is_directory[[1]]) {
5858
new <- rep(new, length(path))
5959
}
60-
assert("Length of `path` must equal length of `new_path`", length(old) == length(new))
60+
assert(
61+
"Length of `path` must equal length of `new_path`",
62+
length(old) == length(new)
63+
)
6164

6265
new[is_directory] <- path(new[is_directory], basename(old))
6366

@@ -72,7 +75,10 @@ dir_copy <- function(path, new_path, overwrite = FALSE) {
7275
assert_no_missing(path)
7376
assert_no_missing(new_path)
7477
assert("`path` must be a directory", all(is_dir(path)))
75-
assert("Length of `path` must equal length of `new_path`", length(path) == length(new_path))
78+
assert(
79+
"Length of `path` must equal length of `new_path`",
80+
length(path) == length(new_path)
81+
)
7682

7783
for (i in seq_along(path)) {
7884
if (!isTRUE(overwrite) && isTRUE(unname(is_dir(new_path[[i]])))) {
@@ -83,13 +89,31 @@ dir_copy <- function(path, new_path, overwrite = FALSE) {
8389
dirs <- dir_ls(path[[i]], type = "directory", recurse = TRUE, all = TRUE)
8490
dir_create(path(new_path[[i]], path_rel(dirs, path[[i]])))
8591

86-
files <- dir_ls(path[[i]], recurse = TRUE,
87-
type = c("unknown", "file", "FIFO", "socket", "character_device", "block_device"), all = TRUE)
88-
file_copy(files, path(new_path[[i]], path_rel(files, path[[i]])), overwrite = overwrite)
89-
90-
links <- dir_ls(path[[i]], recurse = TRUE,
91-
type = "symlink", all = TRUE)
92-
link_copy(links, path(new_path[[i]], path_rel(links, path[[i]])), overwrite = overwrite)
92+
files <- dir_ls(
93+
path[[i]],
94+
recurse = TRUE,
95+
type = c(
96+
"unknown",
97+
"file",
98+
"FIFO",
99+
"socket",
100+
"character_device",
101+
"block_device"
102+
),
103+
all = TRUE
104+
)
105+
file_copy(
106+
files,
107+
path(new_path[[i]], path_rel(files, path[[i]])),
108+
overwrite = overwrite
109+
)
110+
111+
links <- dir_ls(path[[i]], recurse = TRUE, type = "symlink", all = TRUE)
112+
link_copy(
113+
links,
114+
path(new_path[[i]], path_rel(links, path[[i]])),
115+
overwrite = overwrite
116+
)
93117
}
94118

95119
invisible(path_tidy(new_path))

R/create.R

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' compared to [dir.create()], `dir_create()` will silently ignore existing
77
#' directories.
88
#'
9-
#' @param path A character vector of one or more paths. For `link_create()`,
9+
#' @param path A character vector of one or more paths. For `link_create()`,
1010
#' this is the target.
1111
#' @param mode If file/directory is created, what mode should it have?
1212
#'
@@ -47,13 +47,23 @@ file_create <- function(path, ..., mode = "u=rw,go=r") {
4747

4848
#' @export
4949
#' @rdname create
50-
dir_create <- function(path, ..., mode = "u=rwx,go=rx", recurse = TRUE, recursive) {
50+
dir_create <- function(
51+
path,
52+
...,
53+
mode = "u=rwx,go=rx",
54+
recurse = TRUE,
55+
recursive
56+
) {
5157
assert_no_missing(path)
5258
assert("`mode` must be of length 1", length(mode) == 1)
5359

5460
if (!missing(recursive)) {
5561
recurse <- recursive
56-
warning("`recursive` is deprecated, please use `recurse` instead", immediate. = TRUE, call. = FALSE)
62+
warning(
63+
"`recursive` is deprecated, please use `recurse` instead",
64+
immediate. = TRUE,
65+
call. = FALSE
66+
)
5767
}
5868

5969
mode <- as_fs_perms(mode)
@@ -88,7 +98,10 @@ dir_create <- function(path, ..., mode = "u=rwx,go=rx", recurse = TRUE, recursiv
8898
link_create <- function(path, new_path, symbolic = TRUE) {
8999
assert_no_missing(path)
90100
assert_no_missing(new_path)
91-
assert("Length of `path` must equal length of `new_path`", length(path) == length(new_path))
101+
assert(
102+
"Length of `path` must equal length of `new_path`",
103+
length(path) == length(new_path)
104+
)
92105

93106
old <- path_expand(path)
94107
new <- path_expand(new_path)

R/delete.R

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,20 @@ dir_delete <- function(path) {
6565
old <- path_expand(path)
6666

6767
dirs <- dir_ls(old, type = "directory", recurse = TRUE, all = TRUE)
68-
files <- dir_ls(old,
69-
type = c("unknown", "file", "symlink", "FIFO", "socket", "character_device", "block_device"),
68+
files <- dir_ls(
69+
old,
70+
type = c(
71+
"unknown",
72+
"file",
73+
"symlink",
74+
"FIFO",
75+
"socket",
76+
"character_device",
77+
"block_device"
78+
),
7079
recurse = TRUE,
71-
all = TRUE)
80+
all = TRUE
81+
)
7282
.Call(fs_unlink_, files)
7383
.Call(fs_rmdir_, rev(c(old, dirs)))
7484

@@ -80,9 +90,7 @@ dir_delete <- function(path) {
8090
link_delete <- function(path) {
8191
assert_no_missing(path)
8292

83-
assert("`path` must be a link",
84-
all(is_link(path))
85-
)
93+
assert("`path` must be a link", all(is_link(path)))
8694

8795
old <- path_expand(path)
8896

R/file.R

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,25 @@ file_info <- function(path, fail = TRUE, follow = FALSE) {
5757
res$change_time <- .POSIXct(res$change_time)
5858
res$birth_time <- .POSIXct(res$birth_time)
5959

60-
important <- c("path", "type", "size", "permissions", "modification_time", "user", "group")
60+
important <- c(
61+
"path",
62+
"type",
63+
"size",
64+
"permissions",
65+
"modification_time",
66+
"user",
67+
"group"
68+
)
6169
res <- res[c(important, setdiff(names(res), important))]
6270

6371
is_symlink <- !is.na(res$type) & res$type == "symlink"
64-
while(follow && any(is_symlink)) {
72+
while (follow && any(is_symlink)) {
6573
lpath <- link_path(path[is_symlink])
66-
lpath <- ifelse(is_absolute_path(lpath), lpath, path(path_dir(path[is_symlink]), lpath))
74+
lpath <- ifelse(
75+
is_absolute_path(lpath),
76+
lpath,
77+
path(path_dir(path[is_symlink]), lpath)
78+
)
6779
res[is_symlink, ] <- file_info(lpath, fail = fail, follow = FALSE)
6880
is_symlink <- !is.na(res$type) & res$type == "symlink"
6981
}
@@ -88,7 +100,8 @@ file_types <- c(
88100
"FIFO" = 3L,
89101
"symlink" = 4L,
90102
"file" = 5L,
91-
"socket" = 6L)
103+
"socket" = 6L
104+
)
92105

93106
#' Change file permissions
94107
#' @template fs
@@ -216,7 +229,10 @@ file_move <- function(path, new_path) {
216229
if (length(new) == 1 && is_directory[[1]]) {
217230
new <- rep(new, length(path))
218231
}
219-
assert("Length of `path` must equal length of `new_path`", length(old) == length(new))
232+
assert(
233+
"Length of `path` must equal length of `new_path`",
234+
length(old) == length(new)
235+
)
220236

221237
new[is_directory] <- path(new[is_directory], basename(old))
222238

@@ -240,7 +256,11 @@ file_move <- function(path, new_path) {
240256
#' file_info("foo")[c("access_time", "modification_time", "change_time", "birth_time")]
241257
#' \dontshow{setwd(.old_wd)}
242258
#' @export
243-
file_touch <- function(path, access_time = Sys.time(), modification_time = access_time) {
259+
file_touch <- function(
260+
path,
261+
access_time = Sys.time(),
262+
modification_time = access_time
263+
) {
244264
assert_no_missing(path)
245265

246266
access_time <- as.POSIXct(access_time)

0 commit comments

Comments
 (0)