mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-07 08:21:10 +00:00
Merged in GZDB r2463.
This commit is contained in:
parent
cea009484e
commit
193ee733ab
4 changed files with 52 additions and 16 deletions
|
@ -660,6 +660,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check invalid path chars
|
||||
if (!CheckInvalidPathChars(token)) return false;
|
||||
|
||||
// Absolute paths are not supported...
|
||||
if (Path.IsPathRooted(includelump))
|
||||
{
|
||||
|
|
|
@ -98,15 +98,18 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
return false;
|
||||
}
|
||||
|
||||
//check invalid path chars
|
||||
if (!parser.CheckInvalidPathChars(token)) return false;
|
||||
|
||||
//check extension
|
||||
string fileExt = Path.GetExtension(token);
|
||||
if(string.IsNullOrEmpty(fileExt))
|
||||
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;
|
||||
|
@ -149,11 +152,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
return false;
|
||||
}
|
||||
|
||||
//check invalid path chars
|
||||
if (!parser.CheckInvalidPathChars(token)) return false;
|
||||
|
||||
//check extension
|
||||
string ext = Path.GetExtension(token);
|
||||
if(Array.IndexOf(ModelData.SUPPORTED_TEXTURE_EXTENSIONS, ext) == -1)
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -168,6 +168,9 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
return false;
|
||||
}
|
||||
|
||||
//mxd. Check invalid path chars
|
||||
if (!CheckInvalidPathChars(filename)) return false;
|
||||
|
||||
//mxd. Absolute paths are not supported...
|
||||
if (Path.IsPathRooted(filename))
|
||||
{
|
||||
|
|
|
@ -594,6 +594,30 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
return result;
|
||||
}
|
||||
|
||||
//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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue