comparison tango/example/conduits/filescan.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
comparison
equal deleted inserted replaced
131:5825d48b27d1 132:1700239cab2e
1 private import tango.io.Stdout,
2 tango.io.FileScan;
3
4 /*******************************************************************************
5
6 List ".d" files and enclosing folders visible via a directory given
7 as a command-line argument. In this example we're also postponing a
8 flush on Stdout until output is complete. Stdout is usually flushed
9 on each invocation of newline or formatln, but here we're using '\n'
10 to illustrate how to avoid flushing many individual lines
11
12 *******************************************************************************/
13
14 void main(char[][] args)
15 {
16 char[] root = args.length < 2 ? "." : args[1];
17 Stdout.formatln ("Scanning '{}'", root);
18
19 auto scan = (new FileScan)(root, ".d");
20
21 Stdout.format ("\n{} Folders\n", scan.folders.length);
22 foreach (folder; scan.folders)
23 Stdout.format ("{}\n", folder);
24
25 Stdout.format ("\n{0} Files\n", scan.files.length);
26 foreach (file; scan.files)
27 Stdout.format ("{}\n", file);
28
29 Stdout.formatln ("\n{} Errors", scan.errors.length);
30 foreach (error; scan.errors)
31 Stdout (error).newline;
32 }