Skip to content

Commit

Permalink
TST isfileorlink
Browse files Browse the repository at this point in the history
  • Loading branch information
hayd committed Jun 4, 2014
1 parent 2b19774 commit f2a1bd3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,7 @@ export
isfifo,
isfile,
islink,
isfileorlink,
ispath,
isreadable,
issetgid,
Expand Down
2 changes: 1 addition & 1 deletion base/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function rmdir(path::String, recursive::Bool=false)
if recursive
for p=readdir(path)
p = joinpath(path, p)
isfileorlink(p) ? rm(p) : rmdir(p, true)(p)
isfileorlink(p) ? rm(p) : rmdir(p, true)
end
end
@unix_only ret = ccall(:rmdir, Int32, (Ptr{Uint8},), bytestring(path))
Expand Down
2 changes: 1 addition & 1 deletion base/pkg/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ end

function remove(pkg::String)
isdir(".trash") || mkdir(".trash")
ispath(".trash/$pkg") && rmdir(".trash/$pkg", true)
ispath(".trash/$pkg") && rmdir(".trash/$pkg", true)
run(`mv $pkg .trash/`)
end

Expand Down
6 changes: 4 additions & 2 deletions base/stat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ issetuid(st::StatStruct) = (st.mode & 0o4000) > 0
issetgid(st::StatStruct) = (st.mode & 0o2000) > 0
issticky(st::StatStruct) = (st.mode & 0o1000) > 0

isreadable(st::StatStruct) = (st.mode & 0o444) > 0
iswritable(st::StatStruct) = (st.mode & 0o222) > 0
isreadable(st::StatStruct) = (st.mode & 0o444) > 0
iswritable(st::StatStruct) = (st.mode & 0o222) > 0
isexecutable(st::StatStruct) = (st.mode & 0o111) > 0

uperm(st::StatStruct) = uint8(st.mode >> 6) & 0x7
Expand Down Expand Up @@ -108,6 +108,8 @@ for f in {
end

islink(path...) = islink(lstat(path...))
isfileorlink(path...) = isfileorlink(lstat(path...))


# some convenience functions

Expand Down

0 comments on commit f2a1bd3

Please sign in to comment.