comparison api/WarFoundryLoader.cs @ 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 520818033bb6
children 613bc5eaac59
comparison
equal deleted inserted replaced
4:163b35f875ef 5:b9346894319c
157 LogNotifier.Debug(GetType(), "Load files"); 157 LogNotifier.Debug(GetType(), "Load files");
158 PrepareForFileLoad(); 158 PrepareForFileLoad();
159 159
160 foreach (DirectoryInfo directory in directories) 160 foreach (DirectoryInfo directory in directories)
161 { 161 {
162 LogNotifier.Debug(GetType(), "Load from "+directory.FullName); 162 if (directory.Exists)
163 {
164 LogNotifier.Debug(GetType(), "Load from "+directory.FullName);
163 165
164 foreach (FileInfo file in directory.GetFiles()) 166 foreach (FileInfo file in directory.GetFiles())
165 { 167 {
166 LoadFile(file); 168 LoadFile(file);
169 }
170 }
171 else
172 {
173 LogNotifier.WarnFormat(GetType(), "Load for {0} failed because directory didn't exist", directory.FullName);
167 } 174 }
168 } 175 }
169 176
170 ICollection<Race> races = new List<Race>(); 177 ICollection<Race> races = new List<Race>();
171 178