blob: 895fa5f2e46e8aad7d9041043eb08b99ea08ff9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/**************************************************************************/
/* */
/* OCaml */
/* */
/* The OCaml programmers */
/* */
/* Copyright 2020 Institut National de Recherche en Informatique et */
/* en Automatique. */
/* */
/* All rights reserved. This file is distributed under the terms of */
/* the GNU Lesser General Public License version 2.1, with the */
/* special exception on linking described in the file LICENSE. */
/* */
/**************************************************************************/
#include <caml/mlvalues.h>
#include <caml/memory.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include "unixsupport.h"
#ifdef HAS_REALPATH
CAMLprim value caml_unix_realpath (value p)
{
CAMLparam1 (p);
char *r;
value rp;
caml_unix_check_path (p, "realpath");
r = realpath (String_val (p), NULL);
if (r == NULL) { caml_uerror ("realpath", p); }
rp = caml_copy_string (r);
free (r);
CAMLreturn (rp);
}
#else
CAMLprim value caml_unix_realpath (value p)
{ caml_invalid_argument ("realpath not implemented"); }
#endif
|