Skip to content

Commit d81131f

Browse files
rename and make private
Co-Authored-By: Cody Tapscott <[email protected]>
1 parent 8f997dd commit d81131f

File tree

6 files changed

+17
-21
lines changed

6 files changed

+17
-21
lines changed

NEWS.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ New library functions
3333
---------------------
3434

3535
* `logrange(start, stop; length)` makes a range of constant ratio, instead of constant step ([#39071])
36-
* `readdirx` for returning directory contents along with the type of the entries in a vector of new `DirEntry`
37-
objects ([#53377])
3836

3937
New library features
4038
--------------------

base/exports.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,6 @@ export
841841
eof,
842842
fd,
843843
fdio,
844-
DirEntry,
845844
flush,
846845
gethostname,
847846
htol,
@@ -866,7 +865,6 @@ export
866865
readbytes!,
867866
readchomp,
868867
readdir,
869-
readdirx,
870868
readline,
871869
readlines,
872870
readuntil,

base/file.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export
1919
rename,
2020
readlink,
2121
readdir,
22-
readdirx,
2322
rm,
2423
samefile,
2524
sendfile,
@@ -977,15 +976,16 @@ isfifo(obj::DirEntry) = (isunknown(obj) || islink(obj)) ? isfifo(obj.path)
977976
issocket(obj::DirEntry) = (isunknown(obj) || islink(obj)) ? issocket(obj.path) : obj.rawtype == UV_DIRENT_SOCKET
978977
ischardev(obj::DirEntry) = (isunknown(obj) || islink(obj)) ? ischardev(obj.path) : obj.rawtype == UV_DIRENT_CHAR
979978
isblockdev(obj::DirEntry) = (isunknown(obj) || islink(obj)) ? isblockdev(obj.path) : obj.rawtype == UV_DIRENT_BLOCK
979+
realpath(obj::DirEntry) = realpath(obj.path)
980980

981981
"""
982-
readdirx(dir::AbstractString=pwd(); sort::Bool = true) -> Vector{DirEntry}
982+
_readdirx(dir::AbstractString=pwd(); sort::Bool = true) -> Vector{DirEntry}
983983
984984
Return a vector of [`DirEntry`](@ref) objects representing the contents of the directory `dir`,
985985
or the current working directory if not given. If `sort` is true, the returned vector is
986986
sorted by name.
987987
988-
Unlike [`readdir`](@ref), `readdirx` returns [`DirEntry`](@ref) objects, which contain the name of the
988+
Unlike [`readdir`](@ref), `_readdirx` returns [`DirEntry`](@ref) objects, which contain the name of the
989989
file, the directory it is in, and the type of the file which is determined during the
990990
directory scan. This means that calls to [`isfile`](@ref), [`isdir`](@ref), [`islink`](@ref), [`isfifo`](@ref),
991991
[`issocket`](@ref), [`ischardev`](@ref), and [`isblockdev`](@ref) can be made on the
@@ -994,12 +994,12 @@ cannot be determined without a stat call. In these cases the `rawtype` field of
994994
object will be 0 (`UV_DIRENT_UNKNOWN`) and [`isfile`](@ref) etc. will fall back to a `stat` call.
995995
996996
```julia
997-
for obj in readdirx()
998-
isfile(obj) && println("$(obj.name) is a file with path $(obj.path)")
997+
for obj in _readdirx()
998+
isfile(obj) && println("\$(obj.name) is a file with path \$(obj.path)")
999999
end
10001000
```
10011001
"""
1002-
readdirx(dir::AbstractString=pwd(); sort::Bool=true) = _readdir(dir; return_objects=true, sort)::Vector{DirEntry}
1002+
_readdirx(dir::AbstractString=pwd(); sort::Bool=true) = _readdir(dir; return_objects=true, sort)::Vector{DirEntry}
10031003

10041004
function _readdir(dir::AbstractString; return_objects::Bool=false, join::Bool=false, sort::Bool=true)
10051005
# Allocate space for uv_fs_t struct

doc/src/base/file.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Base.Filesystem.pwd
77
Base.Filesystem.cd(::AbstractString)
88
Base.Filesystem.cd(::Function)
99
Base.Filesystem.readdir
10-
Base.Filesystem.readdirx
11-
Base.Filesystem.DirEntry
1210
Base.Filesystem.walkdir
1311
Base.Filesystem.mkdir
1412
Base.Filesystem.mkpath

test/file.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,16 @@ if !Sys.iswindows() || Sys.windows_version() >= Sys.WINDOWS_VISTA_VER
3131
symlink(subdir, dirlink)
3232
@test stat(dirlink) == stat(subdir)
3333
@test readdir(dirlink) == readdir(subdir)
34-
@test readdirx(dirlink) == readdirx(subdir)
34+
@test map(o->o.names, Base.Filesystem._readdirx(dirlink)) == map(o->o.names, Base.Filesystem._readdirx(subdir))
35+
@test realpath.(Base.Filesystem._readdirx(dirlink)) == realpath.(Base.Filesystem._readdirx(subdir))
3536

3637
# relative link
3738
relsubdirlink = joinpath(subdir, "rel_subdirlink")
3839
reldir = joinpath("..", "adir2")
3940
symlink(reldir, relsubdirlink)
4041
@test stat(relsubdirlink) == stat(subdir2)
4142
@test readdir(relsubdirlink) == readdir(subdir2)
42-
@test readdirx(relsubdirlink) == readdirx(subdir2)
43+
@test Base.Filesystem._readdirx(relsubdirlink) == Base.Filesystem._readdirx(subdir2)
4344

4445
# creation of symlink to directory that does not yet exist
4546
new_dir = joinpath(subdir, "new_dir")
@@ -58,7 +59,7 @@ if !Sys.iswindows() || Sys.windows_version() >= Sys.WINDOWS_VISTA_VER
5859
mkdir(new_dir)
5960
touch(foo_file)
6061
@test readdir(new_dir) == readdir(nedlink)
61-
@test readdirx(new_dir) == readdirx(nedlink)
62+
@test realpath.(Base.Filesystem._readdirx(new_dir)) == realpath.(Base.Filesystem._readdirx(nedlink))
6263

6364
rm(foo_file)
6465
rm(new_dir)
@@ -1444,10 +1445,10 @@ rm(dirwalk, recursive=true)
14441445
touch(randstring())
14451446
end
14461447
@test issorted(readdir())
1447-
@test issorted(readdirx())
1448-
@test map(o->o.name, readdirx()) == readdir()
1449-
@test map(o->o.path, readdirx()) == readdir(join=true)
1450-
@test count(isfile, readdir(join=true)) == count(isfile, readdirx())
1448+
@test issorted(Base.Filesystem._readdirx())
1449+
@test map(o->o.name, Base.Filesystem._readdirx()) == readdir()
1450+
@test map(o->o.path, Base.Filesystem._readdirx()) == readdir(join=true)
1451+
@test count(isfile, readdir(join=true)) == count(isfile, Base.Filesystem._readdirx())
14511452
end
14521453
end
14531454
end

test/misc.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,9 +1363,10 @@ end
13631363
@test isdefined(KwdefWithEsc_TestModule, :Struct)
13641364

13651365
@testset "exports of modules" begin
1366-
for (_, mod) in Base.loaded_modules
1366+
@testset "$mod" for (_, mod) in Base.loaded_modules
13671367
mod === Main && continue # Main exports everything
1368-
for v in names(mod)
1368+
@testset "$v" for v in names(mod)
1369+
isdefined(mod, v) || @error "missing $v in $mod"
13691370
@test isdefined(mod, v)
13701371
end
13711372
end

0 commit comments

Comments
 (0)