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