mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-26 05:40:53 +00:00
fixed problem with compiler paths
This commit is contained in:
parent
3e7ad76e9d
commit
455fca63d8
6 changed files with 36 additions and 20 deletions
Build/Scripting
Documents
Source
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Compiler settings
|
// Compiler settings
|
||||||
compiler = "acc";
|
compiler = "acc";
|
||||||
parameters = "-I \"%PT\" -I \"%PW\" %FI %FO";
|
parameters = "-I \"%PT\" -I \"%PS\" %FI %FO";
|
||||||
resultlump = "BEHAVIOR";
|
resultlump = "BEHAVIOR";
|
||||||
|
|
||||||
// Editor settings
|
// Editor settings
|
||||||
|
|
|
@ -16,14 +16,19 @@ file contents are not copied into the wad file.
|
||||||
|
|
||||||
With this interface supports the following placeholders in command-line parameters:
|
With this interface supports the following placeholders in command-line parameters:
|
||||||
|
|
||||||
%FI indicates the input path and filename.
|
%FI indicates the input path and filename (temporary location for compiler).
|
||||||
|
|
||||||
%FO indicates the output path and filename.
|
%FO indicates the output path and filename (temporary location for compiler).
|
||||||
|
|
||||||
|
%FS indicates the path and filename of the original file.
|
||||||
|
|
||||||
%PT indicates the temporary directory path where the compiler is located.
|
%PT indicates the temporary directory path where the compiler is located.
|
||||||
|
|
||||||
%PW indicates the path of the open wad file when compiled as internal script lump.
|
%PS indicates the path of the original file.
|
||||||
If compiled as file, or the wad file is not saved, %PW is the same as %PT
|
|
||||||
|
The 'original file' is the saved location of the WAD file when the script is an
|
||||||
|
internal lump. If the wad file is not saved, %PW is the same as %PT and %FS is the
|
||||||
|
path and filename of the temporary wad file.
|
||||||
|
|
||||||
These placeholders are case-sensitive!
|
These placeholders are case-sensitive!
|
||||||
|
|
||||||
|
|
|
@ -75,22 +75,16 @@ namespace CodeImp.DoomBuilder.Compilers
|
||||||
ProcessStartInfo processinfo;
|
ProcessStartInfo processinfo;
|
||||||
Process process;
|
Process process;
|
||||||
TimeSpan deltatime;
|
TimeSpan deltatime;
|
||||||
string waddir = null;
|
|
||||||
int line = 0;
|
int line = 0;
|
||||||
|
string sourcedir = Path.GetDirectoryName(sourcefile);
|
||||||
// Find wad directory
|
|
||||||
if(General.Map.FilePathName.Length > 0)
|
|
||||||
waddir = Path.GetDirectoryName(General.Map.FilePathName);
|
|
||||||
|
|
||||||
// When no luck, use temp path
|
|
||||||
if(waddir == null) waddir = this.tempdir.FullName;
|
|
||||||
|
|
||||||
// Create parameters
|
// Create parameters
|
||||||
string args = this.parameters;
|
string args = this.parameters;
|
||||||
args = args.Replace("%FI", inputfile);
|
args = args.Replace("%FI", inputfile);
|
||||||
args = args.Replace("%FO", outputfile);
|
args = args.Replace("%FO", outputfile);
|
||||||
|
args = args.Replace("%FS", sourcefile);
|
||||||
args = args.Replace("%PT", this.tempdir.FullName);
|
args = args.Replace("%PT", this.tempdir.FullName);
|
||||||
args = args.Replace("%PW", waddir);
|
args = args.Replace("%PS", sourcedir);
|
||||||
|
|
||||||
// Setup process info
|
// Setup process info
|
||||||
processinfo = new ProcessStartInfo();
|
processinfo = new ProcessStartInfo();
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace CodeImp.DoomBuilder.Compilers
|
||||||
protected CompilerInfo info;
|
protected CompilerInfo info;
|
||||||
protected string parameters;
|
protected string parameters;
|
||||||
protected string workingdir;
|
protected string workingdir;
|
||||||
|
protected string sourcefile;
|
||||||
protected string outputfile;
|
protected string outputfile;
|
||||||
protected string inputfile;
|
protected string inputfile;
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ namespace CodeImp.DoomBuilder.Compilers
|
||||||
|
|
||||||
public string Parameters { get { return parameters; } set { parameters = value; } }
|
public string Parameters { get { return parameters; } set { parameters = value; } }
|
||||||
public string WorkingDirectory { get { return workingdir; } set { workingdir = value; } }
|
public string WorkingDirectory { get { return workingdir; } set { workingdir = value; } }
|
||||||
|
public string SourceFile { get { return sourcefile; } set { sourcefile = value; } }
|
||||||
public string InputFile { get { return inputfile; } set { inputfile = value; } }
|
public string InputFile { get { return inputfile; } set { inputfile = value; } }
|
||||||
public string OutputFile { get { return outputfile; } set { outputfile = value; } }
|
public string OutputFile { get { return outputfile; } set { outputfile = value; } }
|
||||||
public string Location { get { return tempdir.FullName; } }
|
public string Location { get { return tempdir.FullName; } }
|
||||||
|
|
|
@ -108,11 +108,12 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
|
|
||||||
// Make random output filename
|
// Make random output filename
|
||||||
outputfile = General.MakeTempFilename(compiler.Location, "tmp");
|
outputfile = General.MakeTempFilename(compiler.Location, "tmp");
|
||||||
|
|
||||||
// Run compiler
|
// Run compiler
|
||||||
compiler.Parameters = config.Parameters;
|
compiler.Parameters = config.Parameters;
|
||||||
compiler.InputFile = Path.GetFileName(inputfile);
|
compiler.InputFile = Path.GetFileName(inputfile);
|
||||||
compiler.OutputFile = Path.GetFileName(outputfile);
|
compiler.OutputFile = Path.GetFileName(outputfile);
|
||||||
|
compiler.SourceFile = filepathname;
|
||||||
compiler.WorkingDirectory = Path.GetDirectoryName(inputfile);
|
compiler.WorkingDirectory = Path.GetDirectoryName(inputfile);
|
||||||
if(compiler.Run())
|
if(compiler.Run())
|
||||||
{
|
{
|
||||||
|
|
|
@ -638,7 +638,7 @@ namespace CodeImp.DoomBuilder
|
||||||
private bool BuildNodes(string nodebuildername, bool failaswarning)
|
private bool BuildNodes(string nodebuildername, bool failaswarning)
|
||||||
{
|
{
|
||||||
NodebuilderInfo nodebuilder;
|
NodebuilderInfo nodebuilder;
|
||||||
string tempfile1, tempfile2;
|
string tempfile1, tempfile2, sourcefile;
|
||||||
bool lumpscomplete = false;
|
bool lumpscomplete = false;
|
||||||
WAD buildwad;
|
WAD buildwad;
|
||||||
|
|
||||||
|
@ -662,7 +662,13 @@ namespace CodeImp.DoomBuilder
|
||||||
// Make the temporary WAD file
|
// Make the temporary WAD file
|
||||||
General.WriteLogLine("Creating temporary build file: " + tempfile1);
|
General.WriteLogLine("Creating temporary build file: " + tempfile1);
|
||||||
buildwad = new WAD(tempfile1);
|
buildwad = new WAD(tempfile1);
|
||||||
|
|
||||||
|
// Determine source file
|
||||||
|
if(filepathname.Length > 0)
|
||||||
|
sourcefile = filepathname;
|
||||||
|
else
|
||||||
|
sourcefile = tempwad.Filename;
|
||||||
|
|
||||||
// Copy lumps to buildwad
|
// Copy lumps to buildwad
|
||||||
General.WriteLogLine("Copying map lumps to temporary build file...");
|
General.WriteLogLine("Copying map lumps to temporary build file...");
|
||||||
CopyLumpsByType(tempwad, TEMP_MAP_HEADER, buildwad, BUILD_MAP_HEADER, true, false, false, true);
|
CopyLumpsByType(tempwad, TEMP_MAP_HEADER, buildwad, BUILD_MAP_HEADER, true, false, false, true);
|
||||||
|
@ -687,6 +693,7 @@ namespace CodeImp.DoomBuilder
|
||||||
compiler.Parameters = nodebuilder.Parameters;
|
compiler.Parameters = nodebuilder.Parameters;
|
||||||
compiler.InputFile = Path.GetFileName(tempfile1);
|
compiler.InputFile = Path.GetFileName(tempfile1);
|
||||||
compiler.OutputFile = Path.GetFileName(tempfile2);
|
compiler.OutputFile = Path.GetFileName(tempfile2);
|
||||||
|
compiler.SourceFile = sourcefile;
|
||||||
compiler.WorkingDirectory = Path.GetDirectoryName(tempfile1);
|
compiler.WorkingDirectory = Path.GetDirectoryName(tempfile1);
|
||||||
if(compiler.Run())
|
if(compiler.Run())
|
||||||
{
|
{
|
||||||
|
@ -1185,7 +1192,7 @@ namespace CodeImp.DoomBuilder
|
||||||
// Returns true when our code worked properly (even when the compiler returned errors)
|
// Returns true when our code worked properly (even when the compiler returned errors)
|
||||||
internal bool CompileLump(string lumpname, bool clearerrors)
|
internal bool CompileLump(string lumpname, bool clearerrors)
|
||||||
{
|
{
|
||||||
string inputfile, outputfile;
|
string inputfile, outputfile, sourcefile;
|
||||||
Compiler compiler;
|
Compiler compiler;
|
||||||
byte[] filedata;
|
byte[] filedata;
|
||||||
string reallumpname = lumpname;
|
string reallumpname = lumpname;
|
||||||
|
@ -1195,6 +1202,12 @@ namespace CodeImp.DoomBuilder
|
||||||
Lump lump = tempwad.FindLump(reallumpname);
|
Lump lump = tempwad.FindLump(reallumpname);
|
||||||
if(lump == null) throw new Exception("No such lump in temporary wad file '" + reallumpname + "'.");
|
if(lump == null) throw new Exception("No such lump in temporary wad file '" + reallumpname + "'.");
|
||||||
|
|
||||||
|
// Determine source file
|
||||||
|
if(filepathname.Length > 0)
|
||||||
|
sourcefile = filepathname;
|
||||||
|
else
|
||||||
|
sourcefile = tempwad.Filename;
|
||||||
|
|
||||||
// New list of errors
|
// New list of errors
|
||||||
if(clearerrors || (errors == null))
|
if(clearerrors || (errors == null))
|
||||||
errors = new List<CompilerError>();
|
errors = new List<CompilerError>();
|
||||||
|
@ -1230,14 +1243,15 @@ namespace CodeImp.DoomBuilder
|
||||||
errors.Add(new CompilerError("Unable to write script to working file. " + e.GetType().Name + ": " + e.Message));
|
errors.Add(new CompilerError("Unable to write script to working file. " + e.GetType().Name + ": " + e.Message));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make random output filename
|
// Make random output filename
|
||||||
outputfile = General.MakeTempFilename(compiler.Location, "tmp");
|
outputfile = General.MakeTempFilename(compiler.Location, "tmp");
|
||||||
|
|
||||||
// Run compiler
|
// Run compiler
|
||||||
compiler.Parameters = scriptconfig.Parameters;
|
compiler.Parameters = scriptconfig.Parameters;
|
||||||
compiler.InputFile = Path.GetFileName(inputfile);
|
compiler.InputFile = Path.GetFileName(inputfile);
|
||||||
compiler.OutputFile = Path.GetFileName(outputfile);
|
compiler.OutputFile = Path.GetFileName(outputfile);
|
||||||
|
compiler.SourceFile = sourcefile;
|
||||||
compiler.WorkingDirectory = Path.GetDirectoryName(inputfile);
|
compiler.WorkingDirectory = Path.GetDirectoryName(inputfile);
|
||||||
if(compiler.Run())
|
if(compiler.Run())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue