changeset 5:b9346894319c

Fixes #6 - Stop missing data folder being fatal * Add check that directory exists before trying to get file list * Add warning message if directory doesn't exist
author IBBoard <dev@ibboard.co.uk>
date Fri, 26 Dec 2008 12:45:32 +0000
parents 163b35f875ef
children 150a5669cd7b
files api/WarFoundryLoader.cs
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/api/WarFoundryLoader.cs	Fri Dec 26 12:32:16 2008 +0000
+++ b/api/WarFoundryLoader.cs	Fri Dec 26 12:45:32 2008 +0000
@@ -159,11 +159,18 @@
 			
 			foreach (DirectoryInfo directory in directories)
 			{
-				LogNotifier.Debug(GetType(), "Load from "+directory.FullName);
+				if (directory.Exists)
+				{
+					LogNotifier.Debug(GetType(), "Load from "+directory.FullName);
 				
-				foreach (FileInfo file in directory.GetFiles())
+					foreach (FileInfo file in directory.GetFiles())
+					{
+						LoadFile(file);
+					}
+				}
+				else
 				{
-					LoadFile(file);
+					LogNotifier.WarnFormat(GetType(), "Load for {0} failed because directory didn't exist", directory.FullName);
 				}
 			}