Map compilers are no longer copied to a temporary folder when compiling map lumps.

Script editor: incorrect line numbers were displayed in Errors list.
This commit is contained in:
MaxED 2014-05-15 13:16:30 +00:00
parent 15bcea9417
commit abdeb84728
5 changed files with 26 additions and 29 deletions

View file

@ -109,7 +109,8 @@ namespace CodeImp.DoomBuilder.Compilers
// Setup process info
processinfo = new ProcessStartInfo();
processinfo.Arguments = args;
processinfo.FileName = Path.Combine(this.tempdir.FullName, info.ProgramFile);
//processinfo.FileName = Path.Combine(this.tempdir.FullName, info.ProgramFile);
processinfo.FileName = Path.Combine(info.Path, info.ProgramFile); //mxd
processinfo.CreateNoWindow = false;
processinfo.ErrorDialog = false;
processinfo.UseShellExecute = true;

View file

@ -34,7 +34,7 @@ namespace CodeImp.DoomBuilder.Compilers
#region ================== Variables
// Parameters
protected CompilerInfo info;
protected readonly CompilerInfo info;
protected string parameters;
protected string workingdir;
protected string sourcefile;
@ -42,10 +42,10 @@ namespace CodeImp.DoomBuilder.Compilers
protected string inputfile;
// Files
protected DirectoryInfo tempdir;
protected readonly DirectoryInfo tempdir;
// Errors
private List<CompilerError> errors;
private readonly List<CompilerError> errors;
// Disposing
protected bool isdisposed;
@ -135,9 +135,12 @@ namespace CodeImp.DoomBuilder.Compilers
foreach(string f in info.Files)
{
string sourcefile = Path.Combine(info.Path, f);
string targetfile = Path.Combine(tempdir.FullName, f);
if(!File.Exists(sourcefile)) General.ErrorLogger.Add(ErrorType.Error, "The file '" + f + "' required by the '" + info.Name + "' compiler is missing. According to the compiler configuration in '" + info.FileName + "', the was expected to be found in the following path: " + info.Path);
File.Copy(sourcefile, targetfile, true);
if (!File.Exists(sourcefile)) {
General.ErrorLogger.Add(ErrorType.Error, "The file '" + f + "' required by the '" + info.Name + "' compiler is missing. According to the compiler configuration in '" + info.FileName + "', the was expected to be found in the following path: " + info.Path);
} else {
string targetfile = Path.Combine(tempdir.FullName, f);
File.Copy(sourcefile, targetfile, true);
}
}
}
@ -169,16 +172,10 @@ namespace CodeImp.DoomBuilder.Compilers
try
{
// Go for all assemblies
foreach(Assembly a in asms)
{
Type[] types;
foreach(Assembly a in asms) {
// Find the class
if(a == General.ThisAssembly)
types = a.GetTypes();
else
types = a.GetExportedTypes();
Type[] types = (Equals(a, General.ThisAssembly) ? a.GetTypes() : a.GetExportedTypes());
foreach(Type t in types)
{
if(t.IsSubclassOf(typeof(Compiler)) && (t.Name == info.ProgramInterface))

View file

@ -83,7 +83,8 @@ namespace CodeImp.DoomBuilder.Compilers
// Setup process info
processinfo = new ProcessStartInfo();
processinfo.Arguments = args;
processinfo.FileName = Path.Combine(this.tempdir.FullName, info.ProgramFile);
//processinfo.FileName = Path.Combine(this.tempdir.FullName, info.ProgramFile);
processinfo.FileName = Path.Combine(info.Path, info.ProgramFile); //mxd
processinfo.CreateNoWindow = true; //mxd. was false
processinfo.ErrorDialog = false;
processinfo.UseShellExecute = false; //mxd. was true

View file

@ -33,12 +33,12 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Variables
private string filename;
private string name;
private string programfile;
private string programinterface;
private string path;
private List<string> files;
private readonly string filename;
private readonly string name;
private readonly string programfile;
private readonly string programinterface;
private readonly string path;
private readonly List<string> files;
#endregion
@ -58,8 +58,6 @@ namespace CodeImp.DoomBuilder.Config
// Constructor
internal CompilerInfo(string filename, string name, string path, Configuration cfg)
{
IDictionary cfgfiles;
General.WriteLogLine("Registered compiler configuration '" + name + "' from '" + filename + "'");
// Initialize
@ -73,10 +71,10 @@ namespace CodeImp.DoomBuilder.Config
this.programinterface = cfg.ReadSetting("compilers." + name + ".interface", "");
// Make list of files required
cfgfiles = cfg.ReadSetting("compilers." + name, new Hashtable());
IDictionary cfgfiles = cfg.ReadSetting("compilers." + name, new Hashtable());
foreach(DictionaryEntry de in cfgfiles)
{
if(de.Key.ToString() != "interface")
if(de.Key.ToString() != "interface" && de.Key.ToString() != "program")
files.Add(de.Value.ToString());
}
}

View file

@ -344,9 +344,9 @@ namespace CodeImp.DoomBuilder.Controls
ei.ImageIndex = 0;
ei.SubItems.Add(e.description);
if(e.filename.StartsWith("?"))
ei.SubItems.Add(e.filename.Replace("?", "") + " (line " + e.linenumber + ")");
ei.SubItems.Add(e.filename.Replace("?", "") + " (line " + (e.linenumber + 1) + ")");
else
ei.SubItems.Add(Path.GetFileName(e.filename) + " (line " + e.linenumber + ")");
ei.SubItems.Add(Path.GetFileName(e.filename) + " (line " + (e.linenumber + 1) + ")");
ei.Tag = e;
errorlist.Items.Add(ei);
listindex++;