Added metadata merging for inferred directories, needs testing
This commit is contained in:
10
bin/tar.ml
10
bin/tar.ml
@@ -60,11 +60,17 @@ let find path tree =
|
||||
| _ -> failwith "cannot search non-directory"
|
||||
in aux (p, tree)
|
||||
|
||||
let add_child name node map =
|
||||
match (NameMap.find_opt name map, node) with
|
||||
| Some (InferredDirectory (children, _)), Directory (_, md) ->
|
||||
NameMap.add name (Directory (children, md)) map
|
||||
| _ -> NameMap.add name node map
|
||||
(* TODO: add logic for links, device nodes, and replacing inferred directories *)
|
||||
let add_direct name node = function
|
||||
| InferredDirectory (map, md) ->
|
||||
InferredDirectory ((NameMap.add name node map), md)
|
||||
InferredDirectory ((add_child name node map), md)
|
||||
| Directory (map, md) ->
|
||||
Directory ((NameMap.add name node map), md)
|
||||
Directory ((add_child name node map), md)
|
||||
| _ ->
|
||||
Printf.printf "whatever the fuck %s" name; Directory (NameMap.empty, empty_dir_metadata)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user