Mercurial > projects > mde
comparison mde/setup/paths.d @ 81:d8fccaa45d5f
Moved file IO code from mde/mergetag to mde/file[/mergetag] and changed how some errors are caught.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 29 Aug 2008 11:59:43 +0100 |
parents | 79a1809421aa |
children | 56c0ddd90193 |
comparison
equal
deleted
inserted
replaced
80:ea58f277f487 | 81:d8fccaa45d5f |
---|---|
30 * the FilePath has served its immediate purpose, since it's more convenient and creating new | 30 * the FilePath has served its immediate purpose, since it's more convenient and creating new |
31 * FilePaths for adjusted paths should be no slower than mutating existing ones. */ | 31 * FilePaths for adjusted paths should be no slower than mutating existing ones. */ |
32 module mde.setup.paths; | 32 module mde.setup.paths; |
33 | 33 |
34 import mde.exception; | 34 import mde.exception; |
35 import mde.mergetag.Reader; | 35 import mde.file.mergetag.Reader; |
36 import mde.mergetag.Writer; | 36 import mde.file.mergetag.Writer; |
37 import mde.mergetag.DataSet; | 37 import mde.file.mergetag.DataSet; |
38 import mde.mergetag.exception; | 38 import mde.file.mergetag.exception; |
39 | 39 |
40 import tango.io.Console; | 40 import tango.io.Console; |
41 import tango.io.FilePath; | 41 import tango.io.FilePath; |
42 import tango.sys.Environment; | 42 import tango.sys.Environment; |
43 //import tango.scrapple.sys.win32.Registry; // Trouble getting this to work | 43 //import tango.scrapple.sys.win32.Registry; // Trouble getting this to work |
103 foreach (f; files[1..$]) | 103 foreach (f; files[1..$]) |
104 ret ~= ", " ~ f.toString; | 104 ret ~= ", " ~ f.toString; |
105 return ret; | 105 return ret; |
106 } | 106 } |
107 | 107 |
108 /** Check whether the given file exists under any path with either .mtt or .mtb suffix. */ | |
109 bool exists (char[] file) { | |
110 for (uint i = 0; i < pathsLen; ++i) { | |
111 if (FilePath (paths[i]~file~".mtt").exists) return true; | |
112 if (FilePath (paths[i]~file~".mtb").exists) return true; | |
113 } | |
114 return false; | |
115 } | |
116 | |
117 /// Print all paths found. | 108 /// Print all paths found. |
118 static void printPaths () { | 109 static void printPaths () { |
119 Cout ("Data paths found:"); | 110 Cout ("Data paths found:"); |
120 dataDir.coutPaths; | 111 dataDir.coutPaths; |
121 Cout ("\nConf paths found:"); | 112 Cout ("\nConf paths found:"); |