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

readdir must return strings for FilePathsBase compatibility #230

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion src/s3path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ function Base.readdir(fp::S3Path; join=false, sort=true)
sort && sort!(results)

# Return results, possibly joined with the root path if join=true
return join ? joinpath.(fp, results) : results
return join ? string.(joinpath.(fp, results)) : results
else
throw(ArgumentError("\"$fp\" is not a directory"))
end
Expand Down
8 changes: 4 additions & 4 deletions test/s3path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,17 @@ end
function verify_files(path::S3Path)
@test readdir(path) == ["emptydir/", "subdir1/", "test_01.txt"]
@test readdir(path; join=true) ==
[path / "emptydir/", path / "subdir1/", path / "test_01.txt"]
String[path / "emptydir/", path / "subdir1/", path / "test_01.txt"]
@test readdir(path / "emptydir/") == []
@test readdir(path / "emptydir/"; join=true) == []
@test readdir(path / "subdir1/") == ["subdir2/", "test_02.txt", "test_03.txt"]
@test readdir(path / "subdir1/"; join=true) == [
@test readdir(path / "subdir1/"; join=true) == String[
path / "subdir1/" / "subdir2/",
path / "subdir1/" / "test_02.txt",
path / "subdir1/" / "test_03.txt",
]
@test readdir(path / "subdir1/subdir2/") == ["subdir3/", "test_04.txt"]
@test readdir(path / "subdir1/subdir2/"; join=true) == [
@test readdir(path / "subdir1/subdir2/"; join=true) == String[
path / "subdir1/subdir2/" / "subdir3/", path / "subdir1/subdir2/" / "test_04.txt"
]
@test readdir(path / "subdir1/subdir2/subdir3/") == []
Expand All @@ -269,7 +269,7 @@ function verify_files(path::AbstractPath)
@test readdir(path / "emptydir/") == []
VERSION >= v"1.4.0" && @test readdir(path / "emptydir/"; join=true) == []
@test readdir(path / "subdir1/") == ["subdir2", "test_02.txt", "test_03.txt"]
VERSION >= v"1.4.0" && @test readdir(path / "subdir1/"; join=true) == [
VERSION >= v"1.4.0" && @test readdir(path / "subdir1/"; join=true) == String[
path / "subdir1" / "subdir2",
path / "subdir1" / "test_02.txt",
path / "subdir1/" / "subdir1/test_03.txt",
Expand Down