File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
src/pylib/Lib/os_impl/posix_like Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change 3
3
import ../ common
4
4
import ./ mkrmdirImpl
5
5
6
+ import ./ pyCfg
7
+ import ./ chkarg
8
+
9
+ when not InJS:
10
+ importConfig [
11
+ os
12
+ ]
13
+ else :
14
+ template decl(f, val) =
15
+ const `HAVE f` = val
16
+ decl unlinkat, false
17
+
18
+ proc rmdir* (p: PathLike, dir_fd: int ) =
19
+ sys.audit(" os.rmdir" , p, dir_fd)
20
+ var res: cint
21
+ when HAVE_UNLINKAT:
22
+ var unlinkat_unavailable = false
23
+ if dir_fd != DEFAULT_DIR_FD:
24
+ when HAVE_UNLINKAT_RUNTIME:
25
+ res = unlinkat(dir_fd.cint , cstring $ p, AT_REMOVEDIR)
26
+ else :
27
+ unlinkat_unavailable = true
28
+ res = - 1
29
+ else :
30
+ rawRemoveDir(p)
31
+ else :
32
+ rawRemoveDir(p)
33
+ when HAVE_UNLINKAT:
34
+ if unlinkat_unavailable:
35
+ argument_unavailable_error(" dir_fd" )
36
+ if res != 0 :
37
+ raiseExcWithPath(p)
38
+
6
39
proc mkdir* (p: PathLike, mode= 0o 777 , dir_fd: int ){.error: " not implement" .}
7
- proc rmdir* (p: PathLike, dir_fd: int ){.error: " not implement" .}
8
40
9
41
proc rmdir* (path: PathLike) =
10
42
sys.audit(" os.rmdir" , path, - 1 )
You can’t perform that action at this time.
0 commit comments