@@ -66,8 +66,8 @@ julia> mode(p"src/FilePathsBase.jl")
6666-rw-r--r--
6767```
6868"""
69- mode (fp:: SystemPath ) = stat (fp). mode
70- Base. filesize (fp:: SystemPath ) = stat (fp ). size
69+ mode (fp:: SystemPath ) = Mode ( stat (string ( fp)) . mode)
70+ Base. filesize (fp:: SystemPath ) = stat (string (fp) ). size
7171
7272"""
7373 modified(fp::SystemPath) -> DateTime
@@ -80,7 +80,7 @@ julia> modified(p"src/FilePathsBase.jl")
80802017-06-20T04:01:09
8181```
8282"""
83- modified (fp:: SystemPath ) = stat (fp). mtime
83+ modified (fp:: SystemPath ) = unix2datetime ( stat (string ( fp)) . mtime)
8484
8585"""
8686 created(fp::SystemPath) -> DateTime
@@ -93,7 +93,7 @@ julia> created(p"src/FilePathsBase.jl")
93932017-06-20T04:01:09
9494```
9595"""
96- created (fp:: SystemPath ) = stat (fp). ctime
96+ created (fp:: SystemPath ) = unix2datetime ( stat (string ( fp)) . ctime)
9797Base. isdir (fp:: SystemPath ) = isdir (mode (fp))
9898Base. isfile (fp:: SystemPath ) = isfile (mode (fp))
9999Base. islink (fp:: SystemPath ) = islink (lstat (fp). mode)
@@ -108,14 +108,15 @@ Base.isblockdev(fp::SystemPath) = isblockdev(mode(fp))
108108Returns whether the `path` is executable for the current user.
109109"""
110110function isexecutable (fp:: SystemPath )
111- s = stat (fp)
111+ s = stat (string (fp))
112+ mode = Mode (s. mode)
112113 usr = User ()
113114
114115 return (
115- isexecutable (s . mode, :ALL ) ||
116- isexecutable (s . mode, :OTHER ) ||
117- (usr. uid == s. user . uid && isexecutable (s . mode, :USER )) ||
118- (usr. gid == s. group . gid && isexecutable (s . mode, :GROUP ))
116+ isexecutable (mode, :ALL ) ||
117+ isexecutable (mode, :OTHER ) ||
118+ (usr. uid == s. uid && isexecutable (mode, :USER )) ||
119+ (usr. gid == s. gid && isexecutable (mode, :GROUP ))
119120 )
120121end
121122
@@ -125,14 +126,15 @@ end
125126Returns whether the `path` is writable for the current user.
126127"""
127128function Base. iswritable (fp:: SystemPath )
128- s = stat (fp)
129+ s = stat (string (fp))
130+ mode = Mode (s. mode)
129131 usr = User ()
130132
131133 return (
132- iswritable (s . mode, :ALL ) ||
133- iswritable (s . mode, :OTHER ) ||
134- (usr. uid == s. user . uid && iswritable (s . mode, :USER )) ||
135- (usr. gid == s. group . gid && iswritable (s . mode, :GROUP ))
134+ iswritable (mode, :ALL ) ||
135+ iswritable (mode, :OTHER ) ||
136+ (usr. uid == s. uid && iswritable (mode, :USER )) ||
137+ (usr. gid == s. gid && iswritable (mode, :GROUP ))
136138 )
137139end
138140
@@ -142,23 +144,24 @@ end
142144Returns whether the `path` is readable for the current user.
143145"""
144146function Base. isreadable (fp:: SystemPath )
145- s = stat (fp)
147+ s = stat (string (fp))
148+ mode = Mode (s. mode)
146149 usr = User ()
147150
148151 return (
149- isreadable (s . mode, :ALL ) ||
150- isreadable (s . mode, :OTHER ) ||
151- (usr. uid == s. user . uid && isreadable (s . mode, :USER )) ||
152- (usr. gid == s. group . gid && isreadable (s . mode, :GROUP ))
152+ isreadable (mode, :ALL ) ||
153+ isreadable (mode, :OTHER ) ||
154+ (usr. uid == s. uid && isreadable (mode, :USER )) ||
155+ (usr. gid == s. gid && isreadable (mode, :GROUP ))
153156 )
154157end
155158
156159function Base. ismount (fp:: SystemPath )
157160 isdir (fp) || return false
158- s1 = lstat (fp )
161+ s1 = lstat (string (fp) )
159162 # Symbolic links cannot be mount points
160163 islink (fp) && return false
161- s2 = lstat (parent (fp))
164+ s2 = lstat (string ( parent (fp) ))
162165 # If a directory and its parent are on different devices, then the
163166 # directory must be a mount point
164167 (s1. device != s2. device) && return true
0 commit comments