diff options
author | Daniil Baturin <daniil@baturin.org> | 2015-04-26 16:43:21 +0600 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2015-04-26 16:43:21 +0600 |
commit | 3891244d49d3c65ef6da6b8644cfb9097b0d51b0 (patch) | |
tree | 45589a38e11e03b6af9edab7af25d4ab94ec24df /src/vytree.ml | |
parent | 727deb901e3090653644a135c238c2f2878a4d8e (diff) | |
download | vyconf-3891244d49d3c65ef6da6b8644cfb9097b0d51b0.tar.gz vyconf-3891244d49d3c65ef6da6b8644cfb9097b0d51b0.zip |
Add Vytree.exists for checking if path exists in a tree.
Diffstat (limited to 'src/vytree.ml')
-rw-r--r-- | src/vytree.ml | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vytree.ml b/src/vytree.ml index 3177e24..ed5efd2 100644 --- a/src/vytree.ml +++ b/src/vytree.ml @@ -93,6 +93,10 @@ let rec get node path = | [name] -> find_or_fail node name | name :: names -> get (find_or_fail node name) names +let exists node path = + try ignore (get node path); true + with Nonexistent_path -> false + let get_existent_path node path = let rec aux node path acc = match path with |