home
/
code
/
dups.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e13e9ef
)
Handle root path missing or not a directory
author
Siraaj Khandkar
<siraaj@khandkar.net>
Wed, 14 Nov 2018 16:48:33 +0000
(11:48 -0500)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Wed, 14 Nov 2018 16:48:33 +0000
(11:48 -0500)
dups.ml
patch
|
blob
|
blame
|
history
diff --git
a/dups.ml
b/dups.ml
index
0bcc83a
..
a1dca83
100644
(file)
--- a/
dups.ml
+++ b/
dups.ml
@@
-41,7
+41,6
@@
end = struct
let find_files root =
let dirs = Queue.create () in
let files = Queue.create () in
let find_files root =
let dirs = Queue.create () in
let files = Queue.create () in
- Queue.add root dirs;
let explore parent =
Array.iter (Sys.readdir parent) ~f:(fun child ->
let path = Filename.concat parent child in
let explore parent =
Array.iter (Sys.readdir parent) ~f:(fun child ->
let path = Filename.concat parent child in
@@
-73,6
+72,7
@@
end = struct
| file_path ->
Some file_path
in
| file_path ->
Some file_path
in
+ explore root;
Stream.create (fun () ->
next_dir ();
next_file ()
Stream.create (fun () ->
next_dir ();
next_file ()
@@
-121,5
+121,12
@@
let main input =
let () =
let input = ref Paths_on_stdin in
let () =
let input = ref Paths_on_stdin in
- Arg.parse [] (fun path -> input := Root_path path) "";
+ Arg.parse [] (fun path ->
+ if Sys.file_exists path then
+ input := Root_path path
+ else begin
+ eprintf "File does not exist: %S\n%!" path;
+ exit 1
+ end
+ ) "";
main !input
main !input
This page took
0.019156 seconds
and
4
git commands to generate.