Fixed a bug that caused a zero-length file to be created when a resource file was missing.

This commit is contained in:
codeimp 2010-10-03 16:54:38 +00:00
parent e6d4bdb607
commit 97ac5aaa57
3 changed files with 7 additions and 1 deletions

View file

@ -283,7 +283,7 @@ namespace CodeImp.DoomBuilder.Data
catch(Exception e)
{
// Unable to load resource
General.ErrorLogger.Add(ErrorType.Error, "Unable to load resources from location \"" + dl.location + "\". Please make sure the location is accessible and not in use by another program. The resources will now be loaded with this location excluded. You may reload the resources to try again.\n" + e.GetType().Name + " when creating data reader: " + e.Message + ")");
General.ErrorLogger.Add(ErrorType.Error, "Unable to load resources from location \"" + dl.location + "\". Please make sure the location is accessible and not in use by another program. The resources will now be loaded with this location excluded. You may reload the resources to try again.\n" + e.GetType().Name + " when creating data reader: " + e.Message);
General.WriteLogLine(e.StackTrace);
continue;
}

View file

@ -45,6 +45,9 @@ namespace CodeImp.DoomBuilder.Data
public PK3Reader(DataLocation dl) : base(dl)
{
General.WriteLogLine("Opening PK3 resource '" + location.location + "'");
if(!File.Exists(location.location))
throw new FileNotFoundException("Could not find the file \"" + location.location + "\"", location.location);
// Open the zip file
ZipInputStream zipstream = OpenPK3File();

View file

@ -77,6 +77,9 @@ namespace CodeImp.DoomBuilder.Data
{
General.WriteLogLine("Opening WAD resource '" + location.location + "'");
if(!File.Exists(location.location))
throw new FileNotFoundException("Could not find the file \"" + location.location + "\"", location.location);
// Initialize
file = new WAD(location.location, true);
is_iwad = (file.Type == WAD.TYPE_IWAD);