-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-6622: [R] Normalize paths for filesystem API on Windows #5445
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ | |
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| context("test-type") | ||
| context("File system") | ||
|
|
||
| test_that("LocalFilesystem", { | ||
| fs <- LocalFileSystem$create() | ||
|
|
@@ -83,7 +83,6 @@ test_that("SubTreeFilesystem", { | |
| expect_is(st_fs, "FileSystem") | ||
|
||
| st_fs$CreateDir("test") | ||
| st_fs$CopyFile("DESCRIPTION", "DESC.txt") | ||
| skip_on_os("windows") # See ARROW-6622 | ||
| stats <- st_fs$GetTargetStats(c("DESCRIPTION", "test", "nope", "DESC.txt")) | ||
| expect_equal(stats[[1L]]$type, FileType$File) | ||
| expect_equal(stats[[2L]]$type, FileType$Directory) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably use
.Platform$file.sepThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not sure about the name of this function, it is not really doing anything to compute a relative path, you could probably just use
normalizePath(mustWork = FALSE), assuming path doesn't actually have to exist on the filesystem.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re:
.Platform$file.sep, I intended to but then on my Windows VM,.Platform$file.sepreported "/" whiletempfile()still created paths with "\" 🤷♂I originally did
normalizePathbut unfortunately for this use case,normalizePathdoes path expansion, even withmustWork=FALSE. We need to keep the path relative (to whatever the FileSystem object holds as its cwd) and just need Windows\to be converted to/. Regular expressions were my last resort and I'm happy to use something better or more robust if it exists.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks a bit weird to do a no-op replacement on Unix, though I suppose it doesn't work.