Skip to content

Commit b2bc04e

Browse files
committed
Fix short-path handling
1 parent c2ef835 commit b2bc04e

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: Unit tests
77
'on':
88
push:
99
branches:
10-
- wsl-support
10+
- master
1111
pull_request:
1212
branches:
1313
- master

R/utils.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,15 @@ wsl_safe_path <- function(path = NULL, revert = FALSE) {
169169
} else {
170170
path_already_safe <- grepl("^/mnt/", path)
171171
if (os_is_wsl() && !isTRUE(path_already_safe) && !is.na(path)) {
172+
base_file <- basename(path)
173+
path <- dirname(path)
172174
abs_path <- repair_path(utils::shortPathName(path))
173175
drive_letter <- tolower(strtrim(abs_path, 1))
174176
path <- gsub(paste0(drive_letter, ":"),
175177
paste0("/mnt/", drive_letter),
176178
abs_path,
177179
ignore.case = TRUE)
180+
path <- paste0(path, "/", base_file)
178181
}
179182
}
180183
path

0 commit comments

Comments
 (0)