1Load_path(3) OCaml library Load_path(3)
2
3
4
6 Load_path - Management of include directories.
7
9 Module Load_path
10
12 Module Load_path
13 : sig end
14
15
16 Management of include directories.
17
18 This module offers a high level interface to locating files in the load
19 path, which is constructed from -I command line flags and a few other
20 parameters.
21
22 It makes the assumption that the contents of include directories
23 doesn't change during the execution of the compiler.
24
25
26
27
28
29
30 val add_dir : string -> unit
31
32 Add a directory to the end of the load path (i.e. at lowest priority.)
33
34
35
36 val remove_dir : string -> unit
37
38 Remove a directory from the load path
39
40
41
42 val reset : unit -> unit
43
44 Remove all directories
45
46
47 module Dir : sig end
48
49
50
51
52 type auto_include_callback = (Dir.t -> string -> string option) ->
53 string -> string
54
55
56 The type of callback functions on for init ~auto_include
57
58
59
60
61 val no_auto_include : auto_include_callback
62
63 No automatic directory inclusion: misses in the load path raise
64 Not_found as normal.
65
66
67
68 val init : auto_include:auto_include_callback -> string list -> unit
69
70
71 init l is the same as reset (); List.iter add_dir (List.rev l)
72
73
74
75
76 val auto_include_otherlibs : (string -> unit) -> auto_include_callback
77
78
79 auto_include_otherlibs alert is a callback function to be passed to
80 Load_path.init and automatically adds -I +lib to the load path after
81 calling alert lib .
82
83
84
85 val get_paths : unit -> string list
86
87 Return the list of directories passed to add_dir so far.
88
89
90
91 val find : string -> string
92
93 Locate a file in the load path. Raise Not_found if the file cannot be
94 found. This function is optimized for the case where the filename is a
95 basename, i.e. doesn't contain a directory separator.
96
97
98
99 val find_uncap : string -> string
100
101 Same as find , but search also for uncapitalized name, i.e. if name is
102 Foo.ml, allow /path/Foo.ml and /path/foo.ml to match.
103
104
105
106 val add : Dir.t -> unit
107
108 Deprecated.
109
110
111
112 Old name for Load_path.append_dir
113
114
115
116
117 val append_dir : Dir.t -> unit
118
119
120 append_dir d adds d to the end of the load path (i.e. at lowest prior‐
121 ity.
122
123
124
125 val prepend_dir : Dir.t -> unit
126
127
128 prepend_dir d adds d to the start of the load path (i.e. at highest
129 priority.
130
131
132
133 val get : unit -> Dir.t list
134
135 Same as get_paths () , except that it returns a Dir.t list .
136
137
138
139
140
141OCamldoc 2023-07-20 Load_path(3)