fixed crash on missing PK3 structured subdirectories when loading data resources from a directory

This commit is contained in:
codeimp 2009-01-11 10:28:22 +00:00
parent c9ba627df5
commit d107363b59

View file

@ -78,13 +78,19 @@ namespace CodeImp.DoomBuilder.Data
// This returns all files in a given directory
protected override string[] GetAllFiles(string path)
{
return Directory.GetFiles(path, "*", SearchOption.TopDirectoryOnly);
if(Directory.Exists(path))
return Directory.GetFiles(path, "*", SearchOption.TopDirectoryOnly);
else
return new string[0];
}
// This returns all files in a given directory that match the given extension
protected override string[] GetFilesWithExt(string path, string extension)
{
return Directory.GetFiles(path, "*." + extension, SearchOption.TopDirectoryOnly);
if(Directory.Exists(path))
return Directory.GetFiles(path, "*." + extension, SearchOption.TopDirectoryOnly);
else
return new string[0];
}
// This finds the first file that has the specific name, regardless of file extension