Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path_tidy breaks paths with backslashes in them #388

Open
DarwinAwardWinner opened this issue Jul 21, 2022 · 0 comments
Open

path_tidy breaks paths with backslashes in them #388

DarwinAwardWinner opened this issue Jul 21, 2022 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@DarwinAwardWinner
Copy link

I'm on Linux, and I'm dealing with some paths that, for reasons unknown to me, contain backslashes in the file names. It seems that the fs package abjectly refuses to admit the existence of backslashes:

library(fs)
library(assertthat)
myfile <- tempfile("path with a back\\slash")
system(paste("touch", shQuote(myfile)))
assert_that(file.exists(myfile))
#> [1] TRUE
## Fails
assert_that(file_exists(myfile))
#> Error: file_exists(path = myfile) is not TRUE

myfile_tidy <- path_tidy(myfile)
print(myfile_tidy)
#> /var/folders/dt/6dg7l6491fjdpb17tfgld9rc0000gn/T/RtmpHj4ctg/path with a back/slash62c12c0f5718
regex_matching_one_backslash <- "\\\\"
assert_that(grepl(regex_matching_one_backslash, myfile))
#> [1] TRUE
## Fails
assert_that(grepl(regex_matching_one_backslash, myfile_tidy))
#> Error: grepl(pattern = regex_matching_one_backslash, x = myfile_tidy) is not TRUE

Created on 2022-07-21 by the reprex package (v2.0.1)

I'm guessing the package is trying to enforce the same path separator for UNIX and Windows systems, but does this mean that paths with backslashes in them are simply not supported at all?

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants