Add Sys.rmdir
parent
496cc8b3a1
commit
f341db8dbe
2
Changes
2
Changes
|
@ -178,7 +178,7 @@ Working version
|
|||
table format and generic hash function that were in use before OCaml 4.00.
|
||||
(Xavier Leroy, review by Nicolás Ojeda Bär)
|
||||
|
||||
- #9797: Add Sys.mkdir.
|
||||
- #9797: Add Sys.mkdir and Sys.rmdir.
|
||||
(David Allsopp, review by Nicolás Ojeda Bär, Sébastien Hinderer and
|
||||
Xavier Leroy)
|
||||
|
||||
|
|
|
@ -334,6 +334,21 @@ CAMLprim value caml_sys_mkdir(value path, value perm)
|
|||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
||||
CAMLprim value caml_sys_rmdir(value path)
|
||||
{
|
||||
CAMLparam1(path);
|
||||
char_os * p;
|
||||
int ret;
|
||||
caml_sys_check_path(path);
|
||||
p = caml_stat_strdup_to_os(String_val(path));
|
||||
caml_enter_blocking_section();
|
||||
ret = rmdir_os(p);
|
||||
caml_leave_blocking_section();
|
||||
caml_stat_free(p);
|
||||
if (ret == -1) caml_sys_error(path);
|
||||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
||||
CAMLprim value caml_sys_getcwd(value unit)
|
||||
{
|
||||
char_os buff[4096];
|
||||
|
|
|
@ -100,6 +100,12 @@ external mkdir : string -> int -> unit = "caml_sys_mkdir"
|
|||
@since 4.12.0
|
||||
*)
|
||||
|
||||
external rmdir : string -> unit = "caml_sys_rmdir"
|
||||
(** Remove an empty directory.
|
||||
|
||||
@since 4.12.0
|
||||
*)
|
||||
|
||||
external getcwd : unit -> string = "caml_sys_getcwd"
|
||||
(** Return the current working directory of the process. *)
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ external time: unit -> (float [@unboxed]) =
|
|||
"caml_sys_time" "caml_sys_time_unboxed" [@@noalloc]
|
||||
external chdir: string -> unit = "caml_sys_chdir"
|
||||
external mkdir: string -> int -> unit = "caml_sys_mkdir"
|
||||
external rmdir: string -> unit = "caml_sys_rmdir"
|
||||
external getcwd: unit -> string = "caml_sys_getcwd"
|
||||
external readdir : string -> string array = "caml_sys_read_directory"
|
||||
|
||||
|
|
Loading…
Reference in New Issue