diff 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
line wrap: on
line diff
--- a/mde/resource/paths.d	Thu Apr 03 18:15:02 2008 +0100
+++ b/mde/resource/paths.d	Fri Apr 04 17:07:38 2008 +0100
@@ -71,7 +71,15 @@
     */
     IReader makeMTReader (char[] file, PRIORITY readOrder, DataSet ds = null, bool rdHeader = false)
     {
-        if (readOrder == PRIORITY.HIGH_ONLY) return makeReader (paths[pathsLen-1] ~ file, ds, rdHeader);
+        if (readOrder == PRIORITY.HIGH_ONLY) {
+            foreach_reverse (path; paths) {     // starting with highest-priority path...
+                try {
+                    return makeReader (path~file, ds, rdHeader);
+                }
+                catch (MTFileIOException) {}    // Ignore errors regarding no file for now.
+            }
+            throw new MTFileIOException ("Unable to find the file: "~file~"[.mtt|mtb]");
+        }
         else return new mdeReader (file, readOrder, ds, rdHeader, paths);
     }
     
@@ -246,7 +254,7 @@
         }
         
         if (readersLen == 0) {          // totally failed to find any valid files
-            throw new MTFileIOException ("Unable to find the file: "~file[1..$]~"[.mtt|mtb]");
+            throw new MTFileIOException ("Unable to find the file: "~file~"[.mtt|mtb]");
         }
         
         // This is simply the easiest way of adjusting the reading order: