diff mde/setup/paths.d @ 75:25cb7420dc91

A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken. imde's classes are created in a static this instead of mde's main. gl setup code moved from gl/basic.d to gl/draw.d mergetag.DefaultData: now HIGH_LOW priority instead of LOW_HIGH. Reduced type list to only used types; small fix for indent function. setup.paths: new NoFileException thrown instead of MTFileIOException
author Diggory Hardy <diggory.hardy@gmail.com>
date Mon, 28 Jul 2008 18:17:48 +0100
parents 3a737e06dc50
children 79a1809421aa
line wrap: on
line diff
--- a/mde/setup/paths.d	Mon Jul 07 15:54:47 2008 +0100
+++ b/mde/setup/paths.d	Mon Jul 28 18:17:48 2008 +0100
@@ -73,7 +73,7 @@
     {
         FilePath[] files = getFiles (file, readOrder);
         if (files is null)
-            throw new MTFileIOException ("Unable to find the file: "~file~"[.mtt|mtb]");
+            throw new NoFileException ("Unable to find the file: "~file~"[.mtt|mtb]");
         
         return new mdeReader (files, ds, rdHeader);
     }
@@ -125,11 +125,7 @@
     
 private:
     FilePath[] getFiles (char[] filename, PRIORITY readOrder)
-    in {
-        assert (readOrder == PRIORITY.LOW_HIGH ||
-                readOrder == PRIORITY.HIGH_LOW ||
-                readOrder == PRIORITY.HIGH_ONLY );
-    } body {
+    {
         FilePath[] ret;
         
         debug (mdeUnitTest) {
@@ -150,6 +146,9 @@
                     ret ~= file;
             }
         } else {
+            assert (readOrder == PRIORITY.HIGH_LOW ||
+                    readOrder == PRIORITY.HIGH_ONLY );
+            
             for (int i = pathsLen - 1; i >= 0; --i) {
                 FilePath file = findFile (paths[i]~filename);
                 if (file !is null) {
@@ -367,4 +366,11 @@
     
             PRIORITY rdOrder;
     }
+}
+
+/// Thrown when makeMTReader couldn't find a file.
+class NoFileException : MTFileIOException {
+    this (char[] msg) {
+        super(msg);
+    }
 }
\ No newline at end of file