let n = List.length fragments in
List.nth fragments (n - 1);;
+let valid_input_file : string -> bool =
+ fun (file : string) ->
+ let fragments = Str.split (Str.regexp "\.") file in
+ let n = List.length fragments in
+ let extension = List.nth fragments (n - 1) in
+ if extension = "csv" || extension = "wav" then true
+ else false;;
+
+let chk_input_path : string -> bool =
+ fun (path : string) ->
+ let file_in = file_of_path path in
+ valid_input_file file_in;;
+
let stdinput = fun (x : unit) ->
let path = Unix.readlink "/proc/self/fd/0" in
- if path <> "/dev/pts/4" then
+ if chk_input_path path then
( incr size_input;
inputs := !inputs @ [path] )
else ();;
+let chk_output_path : string -> bool =
+ fun (path : string) ->
+ let fragments = Str.split (Str.regexp "/") path in
+ let location = List.nth fragments 0 in
+ if location = "dev" then false
+ else true;;
+
let stdoutput = fun (x : unit) ->
let path = Unix.readlink "/proc/self/fd/1" in
- if path <> "/dev/pts/4" then output := path
+ if chk_output_path path then output := path
else ();;
let stdio = fun (x : unit) ->