Merged in GZDB r2463.

This commit is contained in:
MascaraSnake 2016-01-22 23:50:23 +01:00
parent cea009484e
commit 193ee733ab
4 changed files with 52 additions and 16 deletions

View file

@ -660,8 +660,11 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
return false;
}
// Absolute paths are not supported...
if(Path.IsPathRooted(includelump))
// Check invalid path chars
if (!CheckInvalidPathChars(token)) return false;
// Absolute paths are not supported...
if (Path.IsPathRooted(includelump))
{
ReportError("Absolute include paths are not supported by ZDoom");
return false;

View file

@ -96,17 +96,20 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
{
parser.ReportError("Expected model name");
return false;
}
}
//check extension
string fileExt = Path.GetExtension(token);
if(string.IsNullOrEmpty(fileExt))
//check invalid path chars
if (!parser.CheckInvalidPathChars(token)) return false;
//check extension
string modelext = Path.GetExtension(token);
if(string.IsNullOrEmpty(modelext))
{
parser.ReportError("Model '" + token + "' won't be loaded. Models without extension are not supported by GZDoom");
return false;
}
if(fileExt != ".md3" && fileExt != ".md2")
if(modelext != ".md3" && modelext != ".md2")
{
parser.ReportError("Model '" + token + "' won't be loaded. Only MD2 and MD3 models are supported");
return false;
@ -147,13 +150,16 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
{
parser.ReportError("Skin path required");
return false;
}
}
//check extension
string ext = Path.GetExtension(token);
if(Array.IndexOf(ModelData.SUPPORTED_TEXTURE_EXTENSIONS, ext) == -1)
//check invalid path chars
if (!parser.CheckInvalidPathChars(token)) return false;
//check extension
string texext = Path.GetExtension(token);
if(Array.IndexOf(ModelData.SUPPORTED_TEXTURE_EXTENSIONS, texext) == -1)
{
parser.ReportError("Image format '" + ext + "' is not supported");
parser.ReportError("Image format '" + texext + "' is not supported");
return false;
}

View file

@ -168,8 +168,11 @@ namespace CodeImp.DoomBuilder.ZDoom
return false;
}
//mxd. Absolute paths are not supported...
if(Path.IsPathRooted(filename))
//mxd. Check invalid path chars
if (!CheckInvalidPathChars(filename)) return false;
//mxd. Absolute paths are not supported...
if (Path.IsPathRooted(filename))
{
ReportError("Absolute include paths are not supported by ZDoom");
return false;

View file

@ -594,8 +594,32 @@ namespace CodeImp.DoomBuilder.ZDoom
return result;
}
//mxd. Language type
protected abstract string GetLanguageType();
//mxd. This replicates System.IO.Path.CheckInvalidPathChars() internal function
public bool CheckInvalidPathChars(string path)
{
foreach (char c in path)
{
int num = c;
switch (num)
{
case 34:
case 60:
case 62:
case 124:
ReportError("unsupported character \"" + c + "\" in path \"" + path + "\".");
return false;
default:
if (num >= 32) continue;
goto case 34;
}
}
return true;
}
//mxd. Language type
protected abstract string GetLanguageType();
#endregion
}