Fix Path.extract_build* functions when applied on the build_dir itself
This should fix #20
This commit is contained in:
parent
ba08f27678
commit
1dcf38af93
28
src/path.ml
28
src/path.ml
|
@ -309,24 +309,28 @@ let is_in_build_dir t =
|
||||||
let extract_build_context t =
|
let extract_build_context t =
|
||||||
if is_local t && String.is_prefix t ~prefix:build_prefix then
|
if is_local t && String.is_prefix t ~prefix:build_prefix then
|
||||||
let i = String.length build_prefix in
|
let i = String.length build_prefix in
|
||||||
match String.index_from t i '/' with
|
let j =
|
||||||
| exception _ -> None
|
match String.index_from t i '/' with
|
||||||
| j ->
|
| exception _ -> String.length t
|
||||||
Some
|
| j -> j
|
||||||
(String.sub t ~pos:i ~len:(j - i),
|
in
|
||||||
String.sub t ~pos:(j + 1) ~len:(String.length t - j - 1))
|
Some
|
||||||
|
(String.sub t ~pos:i ~len:(j - i),
|
||||||
|
String.sub t ~pos:(j + 1) ~len:(String.length t - j - 1))
|
||||||
else
|
else
|
||||||
None
|
None
|
||||||
|
|
||||||
let extract_build_context_dir t =
|
let extract_build_context_dir t =
|
||||||
if is_local t && String.is_prefix t ~prefix:build_prefix then
|
if is_local t && String.is_prefix t ~prefix:build_prefix then
|
||||||
let i = String.length build_prefix in
|
let i = String.length build_prefix in
|
||||||
match String.index_from t i '/' with
|
let j =
|
||||||
| exception _ -> None
|
match String.index_from t i '/' with
|
||||||
| j ->
|
| exception _ -> String.length t
|
||||||
Some
|
| j -> j
|
||||||
(String.sub t ~pos:0 ~len:j,
|
in
|
||||||
String.sub t ~pos:(j + 1) ~len:(String.length t - j - 1))
|
Some
|
||||||
|
(String.sub t ~pos:0 ~len:j,
|
||||||
|
String.sub t ~pos:(j + 1) ~len:(String.length t - j - 1))
|
||||||
else
|
else
|
||||||
None
|
None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue