comparison mde/resource/paths.d @ 27:0aa621b3e070

Some GUI work, plus a small fix in the paths module. Implemented GUI code to load windows from file with a basic widget and draw. Fixed a bug in mde.resource.paths.mdeDirectory.makeMTReader when called with readOrder == PRIORITY.HIGH_ONLY. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 04 Apr 2008 17:07:38 +0100
parents 611f7b9063c6
children b5fadd8d930b
comparison
equal deleted inserted replaced
26:611f7b9063c6 27:0aa621b3e070
69 * ds = The dataset, as for mergetag. Note: all actual readers share one dataset. 69 * ds = The dataset, as for mergetag. Note: all actual readers share one dataset.
70 * rdHeader = Read the headers for each file and merge if rdHeader == true. 70 * rdHeader = Read the headers for each file and merge if rdHeader == true.
71 */ 71 */
72 IReader makeMTReader (char[] file, PRIORITY readOrder, DataSet ds = null, bool rdHeader = false) 72 IReader makeMTReader (char[] file, PRIORITY readOrder, DataSet ds = null, bool rdHeader = false)
73 { 73 {
74 if (readOrder == PRIORITY.HIGH_ONLY) return makeReader (paths[pathsLen-1] ~ file, ds, rdHeader); 74 if (readOrder == PRIORITY.HIGH_ONLY) {
75 foreach_reverse (path; paths) { // starting with highest-priority path...
76 try {
77 return makeReader (path~file, ds, rdHeader);
78 }
79 catch (MTFileIOException) {} // Ignore errors regarding no file for now.
80 }
81 throw new MTFileIOException ("Unable to find the file: "~file~"[.mtt|mtb]");
82 }
75 else return new mdeReader (file, readOrder, ds, rdHeader, paths); 83 else return new mdeReader (file, readOrder, ds, rdHeader, paths);
76 } 84 }
77 85
78 /** Creates an MT writer for file deciding on the best path to use. 86 /** Creates an MT writer for file deciding on the best path to use.
79 * 87 *
244 } 252 }
245 catch (MTFileIOException) {} // Ignore errors regarding no file for now. 253 catch (MTFileIOException) {} // Ignore errors regarding no file for now.
246 } 254 }
247 255
248 if (readersLen == 0) { // totally failed to find any valid files 256 if (readersLen == 0) { // totally failed to find any valid files
249 throw new MTFileIOException ("Unable to find the file: "~file[1..$]~"[.mtt|mtb]"); 257 throw new MTFileIOException ("Unable to find the file: "~file~"[.mtt|mtb]");
250 } 258 }
251 259
252 // This is simply the easiest way of adjusting the reading order: 260 // This is simply the easiest way of adjusting the reading order:
253 if (readOrder == PRIORITY.HIGH_LOW) readers[0..readersLen].reverse; 261 if (readOrder == PRIORITY.HIGH_LOW) readers[0..readersLen].reverse;
254 } 262 }