From: Remi V. <van...@la...> - 2003-11-17 10:12:21
|
<syl...@po...> writes: > Hello, > Hello, >> > SysUtil.mli : >> > >> > (** Pattern you can use to test file *) >> > type test_file = >> > Is_dev_block >> > | Is_dev_char >> > | Is_dir >> > | Exists >> > | Is_file >> > | Is_set_group_ID >> > | Has_sticky_bit >> > | Is_link >> > | Is_pipe >> > | Is_readable >> > | Is_writeable >> > | Size_not_null >> > | Is_socket >> > | Has_set_user_ID >> > | Is_exec >> > | Is_owned_by_user_ID >> > | Is_owned_by_group_ID >> > | Is_newer_than of string * string >> > | Is_older_than of string * string >> > | Has_same_device_and_inode of string * string >> > | And of test_file * test_file >> > | Or of test_file * test_file >> > | Not of test_file >> > | Match of string >> > | True >> > | False >> >> It's very interesting. >> Some possible amelioration : >> - What Is_newer_than mean exactly, what are those 2 string? > > The two strings are filename > I mean, I understood what is the result of the test Exists apply to the filename "foo". I don't understood what is the result of the test (Is_newer_than ("bar", "quux")) apply to the filename "foo". >> - a Is_bigger_than of int and a Is_smaller_than of int could be >> useful; > I treat of file not of int, i don't want to get <, >, <=, >= in my > library ( but if you insist, it is not very complicated to add this test > ). The idea was to compare the size of the file with an number of octet (or any other size measurement that could be useful). >> - for the newer and older, It could be useful to give a date >> directly; > > And the date problem arise : yes but which date ( actually ocaml std > library only provide timestamp conversion... ). I agree there. As I've understood, you use the Unix.stat function for your implementation, so I would use the same format than the st_?time field of the stats type. > >> - I would use : Or of test_file list and And of test_file list; >> > > Yes.... Think, i'll keep And/Or and add AndList/OrList Well, it is not so important, just a preference of mine. -- Rémi Vanicat |