@@ -4,13 +4,15 @@ let ifDebug debug name fn v =
4
4
if debug then Log. log (name ^ " : " ^ fn v);
5
5
v
6
6
7
+ let ( ++ ) = Filename. concat
8
+
7
9
(* Returns a list of paths, relative to the provided `base` *)
8
10
let getSourceDirectories ~includeDev base config =
9
11
let rec handleItem current item =
10
12
match item with
11
13
| Json. Array contents ->
12
14
List. map (handleItem current) contents |> List. concat
13
- | Json. String text -> [current / + text]
15
+ | Json. String text -> [current + + text]
14
16
| Json. Object _ -> (
15
17
let dir =
16
18
Json. get " dir" item |?> Json. string |? " Must specify directory"
@@ -22,13 +24,13 @@ let getSourceDirectories ~includeDev base config =
22
24
if typ = " dev" then []
23
25
else
24
26
match item |> Json. get " subdirs" with
25
- | None | Some Json. False -> [current / + dir]
27
+ | None | Some Json. False -> [current + + dir]
26
28
| Some Json. True ->
27
- Files. collectDirs (base /+ current / + dir)
29
+ Files. collectDirs (base ++ current + + dir)
28
30
(* |> ifDebug(true, "Subdirs", String.concat(" - ")) *)
29
31
|> List. filter (fun name -> name <> Filename. current_dir_name)
30
32
|> List. map (Files. relpath base)
31
- | Some item -> (current /+ dir) :: handleItem (current / + dir) item)
33
+ | Some item -> (current ++ dir) :: handleItem (current + + dir) item)
32
34
| _ -> failwith " Invalid subdirs entry"
33
35
in
34
36
match config |> Json. get " sources" with
@@ -104,11 +106,11 @@ let collectFiles directory =
104
106
compileds
105
107
|> List. map (fun path ->
106
108
let modName = getName path in
107
- let compiled = directory / + path in
109
+ let compiled = directory + + path in
108
110
let source =
109
111
Utils. find
110
112
(fun name ->
111
- if getName name = modName then Some (directory / + name) else None )
113
+ if getName name = modName then Some (directory + + name) else None )
112
114
sources
113
115
in
114
116
(modName, SharedTypes. Impl (compiled, source)))
@@ -117,7 +119,7 @@ let collectFiles directory =
117
119
let findProjectFiles ~debug namespace root sourceDirectories compiledBase =
118
120
let files =
119
121
sourceDirectories
120
- |> List. map (Files. fileConcat root)
122
+ |> List. map (Filename. concat root)
121
123
|> ifDebug debug " Source directories" (String. concat " - " )
122
124
|> List. map (fun name -> Files. collect name isSourceFile)
123
125
|> List. concat |> Utils. dedup
@@ -127,8 +129,8 @@ let findProjectFiles ~debug namespace root sourceDirectories compiledBase =
127
129
|> Utils.filterMap(path => {
128
130
let rel = Files.relpath(root, path);
129
131
ifOneExists([
130
- compiledBase / + cmtName(~namespace, rel),
131
- compiledBase / + cmiName(~namespace, rel),
132
+ compiledBase + + cmtName(~namespace, rel),
133
+ compiledBase + + cmiName(~namespace, rel),
132
134
]) |?>> cm => (cm, path)
133
135
})
134
136
|> ifDebug(debug, "With compiled base", (items) => String.concat("\n", List.map(((a, b)) => a ++ " : " ++ b, items)))
@@ -161,8 +163,8 @@ let findProjectFiles ~debug namespace root sourceDirectories compiledBase =
161
163
let base = compiledBaseName ~namespace (Files. relpath root path) in
162
164
match intf with
163
165
| Some intf ->
164
- let cmti = (compiledBase / + base) ^ " .cmti" in
165
- let cmt = (compiledBase / + base) ^ " .cmt" in
166
+ let cmti = (compiledBase + + base) ^ " .cmti" in
167
+ let cmt = (compiledBase + + base) ^ " .cmt" in
166
168
if Files. exists cmti then
167
169
if Files. exists cmt then
168
170
(* Log.log("Intf and impl " ++ cmti ++ " " ++ cmt) *)
@@ -171,15 +173,15 @@ let findProjectFiles ~debug namespace root sourceDirectories compiledBase =
171
173
else (
172
174
(* Log.log("Just intf " ++ cmti) *)
173
175
Log. log
174
- (" Bad source file (no cmt/cmti/cmi) " ^ (compiledBase / + base)
176
+ (" Bad source file (no cmt/cmti/cmi) " ^ (compiledBase + + base)
175
177
);
176
178
None )
177
179
| None ->
178
- let cmt = (compiledBase / + base) ^ " .cmt" in
180
+ let cmt = (compiledBase + + base) ^ " .cmt" in
179
181
if Files. exists cmt then Some (mname, Impl (cmt, Some path))
180
182
else (
181
183
Log. log
182
- (" Bad source file (no cmt/cmi) " ^ (compiledBase / + base));
184
+ (" Bad source file (no cmt/cmi) " ^ (compiledBase + + base));
183
185
None ))
184
186
else (
185
187
Log. log (" Bad source file (extension) " ^ path);
@@ -191,7 +193,7 @@ let findProjectFiles ~debug namespace root sourceDirectories compiledBase =
191
193
(fun mname intf res ->
192
194
let base = compiledBaseName ~namespace (Files. relpath root intf) in
193
195
Log. log (" Extra intf " ^ intf);
194
- let cmti = (compiledBase / + base) ^ " .cmti" in
196
+ let cmti = (compiledBase + + base) ^ " .cmti" in
195
197
if Files. exists cmti then
196
198
(mname, SharedTypes. Intf (cmti, intf)) :: res
197
199
else res)
@@ -205,7 +207,7 @@ let findProjectFiles ~debug namespace root sourceDirectories compiledBase =
205
207
| None -> result
206
208
| Some namespace ->
207
209
let mname = nameSpaceToName namespace in
208
- let cmt = (compiledBase / + namespace) ^ " .cmt" in
210
+ let cmt = (compiledBase + + namespace) ^ " .cmt" in
209
211
Log. log (" adding namespace " ^ namespace ^ " : " ^ mname ^ " : " ^ cmt);
210
212
(mname, Impl (cmt, None )) :: result
211
213
@@ -234,7 +236,7 @@ let findDependencyFiles ~debug base config =
234
236
let result =
235
237
ModuleResolution. resolveNodeModulePath ~start Path:base name
236
238
|?> fun loc ->
237
- let innerPath = loc / + " bsconfig.json" in
239
+ let innerPath = loc + + " bsconfig.json" in
238
240
Log. log (" Dep loc " ^ innerPath);
239
241
match Files. readFile innerPath with
240
242
| Some text -> (
@@ -248,7 +250,7 @@ let findDependencyFiles ~debug base config =
248
250
| Some compiledBase ->
249
251
if debug then Log. log (" Compiled base: " ^ compiledBase);
250
252
let compiledDirectories =
251
- directories |> List. map (Files. fileConcat compiledBase)
253
+ directories |> List. map (Filename. concat compiledBase)
252
254
in
253
255
let compiledDirectories =
254
256
match namespace with
0 commit comments