mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 12:50:52 +00:00
ACS parser: fixed problem when trying to include files that contain invalid characters. Fixes #664
This commit is contained in:
parent
32acb551c3
commit
a75249b315
2 changed files with 18 additions and 6 deletions
|
@ -3046,14 +3046,22 @@ namespace CodeImp.DoomBuilder.Data
|
|||
internal TextResourceData GetTextResourceData(string name)
|
||||
{
|
||||
// Filesystem path?
|
||||
if(Path.IsPathRooted(name))
|
||||
try
|
||||
{
|
||||
if(File.Exists(name))
|
||||
if (Path.IsPathRooted(name))
|
||||
{
|
||||
DataLocation location = new DataLocation{ location = name, type = DataLocation.RESOURCE_DIRECTORY };
|
||||
return new TextResourceData(File.OpenRead(name), location, name);
|
||||
}
|
||||
if (File.Exists(name))
|
||||
{
|
||||
DataLocation location = new DataLocation { location = name, type = DataLocation.RESOURCE_DIRECTORY };
|
||||
return new TextResourceData(File.OpenRead(name), location, name);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
// File and/or path contained illegal characters
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -2104,7 +2104,11 @@ namespace CodeImp.DoomBuilder
|
|||
OnInclude = delegate(AcsParserSE se, string includefile, AcsParserSE.IncludeType includetype)
|
||||
{
|
||||
TextResourceData includedata = General.Map.Data.GetTextResourceData(includefile);
|
||||
if(includedata == null) return false; // Fial
|
||||
if (includedata == null)
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Could not find file to include while loading " + maplumpinfo.Name + ": " + includefile);
|
||||
return false; // Fail
|
||||
}
|
||||
return se.Parse(includedata, true, includetype, false);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue