mirror of https://gitlab.com/basile.b/dexed.git
fix, param currentDirectory for TProcess doesnt work under nix, added additional ChDir
This commit is contained in:
parent
0055054c59
commit
6d3e29a869
|
@ -1712,6 +1712,7 @@ begin
|
||||||
else firstlineFlags:= '';
|
else firstlineFlags:= '';
|
||||||
end else firstlineFlags:= '';
|
end else firstlineFlags:= '';
|
||||||
|
|
||||||
|
|
||||||
fRunProc := TCEProcess.Create(nil);
|
fRunProc := TCEProcess.Create(nil);
|
||||||
if redirect then
|
if redirect then
|
||||||
begin
|
begin
|
||||||
|
@ -1768,7 +1769,7 @@ begin
|
||||||
begin
|
begin
|
||||||
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled',
|
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled',
|
||||||
fDoc, amcEdit, amkInf);
|
fDoc, amcEdit, amkInf);
|
||||||
fRunProc.CurrentDirectory := extractFilePath(fRunProc.Executable);
|
fRunProc.CurrentDirectory := extractFileDir(fRunProc.Executable);
|
||||||
if runArgs <> '' then
|
if runArgs <> '' then
|
||||||
begin
|
begin
|
||||||
extraArgs.Clear;
|
extraArgs.Clear;
|
||||||
|
|
|
@ -30,6 +30,7 @@ type
|
||||||
fModified: boolean;
|
fModified: boolean;
|
||||||
fRootFolder: string;
|
fRootFolder: string;
|
||||||
fBasePath: string;
|
fBasePath: string;
|
||||||
|
fRunnerOldCwd: string;
|
||||||
fLibAliases: TStringList;
|
fLibAliases: TStringList;
|
||||||
fConfigs: TCollection;
|
fConfigs: TCollection;
|
||||||
fSrcs, fSrcsCop: TStringList;
|
fSrcs, fSrcsCop: TStringList;
|
||||||
|
@ -123,6 +124,7 @@ constructor TCENativeProject.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited create(aOwner);
|
inherited create(aOwner);
|
||||||
//
|
//
|
||||||
|
fRunnerOldCwd := GetCurrentDir;
|
||||||
fProjectSubject := TCEProjectSubject.create;
|
fProjectSubject := TCEProjectSubject.create;
|
||||||
//
|
//
|
||||||
fLibAliases := TStringList.Create;
|
fLibAliases := TStringList.Create;
|
||||||
|
@ -196,7 +198,7 @@ begin
|
||||||
else absSrc := expandFilenameEx(fBasePath, relsrc);
|
else absSrc := expandFilenameEx(fBasePath, relsrc);
|
||||||
if SameFileName(aFilename, absSrc) then exit;
|
if SameFileName(aFilename, absSrc) then exit;
|
||||||
end;
|
end;
|
||||||
relSrc := ExtractRelativepath(fBasePath, ExcludeLeadingPathDelimiter(aFilename));
|
relSrc := ExtractRelativePath(fBasePath, aFilename);
|
||||||
fSrcs.Add(relSrc);
|
fSrcs.Add(relSrc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -676,7 +678,7 @@ function TCENativeProject.compile: Boolean;
|
||||||
var
|
var
|
||||||
config: TCompilerConfiguration;
|
config: TCompilerConfiguration;
|
||||||
compilproc: TProcess;
|
compilproc: TProcess;
|
||||||
prjpath: string;
|
prjpath, oldCwd: string;
|
||||||
prjname: string;
|
prjname: string;
|
||||||
msgs: ICEMessagesDisplay;
|
msgs: ICEMessagesDisplay;
|
||||||
begin
|
begin
|
||||||
|
@ -700,11 +702,14 @@ begin
|
||||||
if (Sources.Count = 0) and (config.pathsOptions.extraSources.Count = 0) then
|
if (Sources.Count = 0) and (config.pathsOptions.extraSources.Count = 0) then
|
||||||
exit;
|
exit;
|
||||||
//
|
//
|
||||||
|
prjpath := extractFilePath(fFileName);
|
||||||
|
oldCwd := GetCurrentDir;
|
||||||
|
ChDir(prjpath);
|
||||||
prjname := shortenPath(filename, 25);
|
prjname := shortenPath(filename, 25);
|
||||||
compilproc := TProcess.Create(nil);
|
compilproc := TProcess.Create(nil);
|
||||||
try
|
try
|
||||||
msgs.message('compiling ' + prjname, self as ICECommonProject, amcProj, amkInf);
|
msgs.message('compiling ' + prjname, self as ICECommonProject, amcProj, amkInf);
|
||||||
prjpath := extractFilePath(fileName);
|
// this doesn't work under linux, so the previous ChDir.
|
||||||
if directoryExists(prjpath) then
|
if directoryExists(prjpath) then
|
||||||
compilproc.CurrentDirectory := prjpath;
|
compilproc.CurrentDirectory := prjpath;
|
||||||
compilproc.Executable := DCompiler;
|
compilproc.Executable := DCompiler;
|
||||||
|
@ -727,6 +732,7 @@ begin
|
||||||
finally
|
finally
|
||||||
updateOutFilename;
|
updateOutFilename;
|
||||||
compilproc.Free;
|
compilproc.Free;
|
||||||
|
ChDir(oldCwd);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -734,9 +740,12 @@ function TCENativeProject.run(const runArgs: string = ''): Boolean;
|
||||||
var
|
var
|
||||||
prm: string;
|
prm: string;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
cwd: string;
|
||||||
begin
|
begin
|
||||||
result := false;
|
result := false;
|
||||||
killProcess(fRunner);
|
killProcess(fRunner);
|
||||||
|
if DirectoryExists(fRunnerOldCwd) then
|
||||||
|
ChDir(fRunnerOldCwd);
|
||||||
//
|
//
|
||||||
fRunner := TCEProcess.Create(nil); // fRunner can use the input process widget.
|
fRunner := TCEProcess.Create(nil); // fRunner can use the input process widget.
|
||||||
currentConfiguration.runOptions.setProcess(fRunner);
|
currentConfiguration.runOptions.setProcess(fRunner);
|
||||||
|
@ -761,7 +770,12 @@ begin
|
||||||
//
|
//
|
||||||
fRunner.Executable := outputFilename;
|
fRunner.Executable := outputFilename;
|
||||||
if fRunner.CurrentDirectory = '' then
|
if fRunner.CurrentDirectory = '' then
|
||||||
fRunner.CurrentDirectory := extractFilePath(fRunner.Executable);
|
begin
|
||||||
|
fRunnerOldCwd := GetCurrentDir;
|
||||||
|
cwd := extractFilePath(fRunner.Executable);
|
||||||
|
chDir(cwd);
|
||||||
|
fRunner.CurrentDirectory := cwd;
|
||||||
|
end;
|
||||||
if poUsePipes in fRunner.Options then begin
|
if poUsePipes in fRunner.Options then begin
|
||||||
fRunner.OnReadData := @runProcOutput;
|
fRunner.OnReadData := @runProcOutput;
|
||||||
fRunner.OnTerminate := @runProcOutput;
|
fRunner.OnTerminate := @runProcOutput;
|
||||||
|
@ -792,7 +806,10 @@ begin
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
if not TProcess(sender).Active then
|
if not TProcess(sender).Active then
|
||||||
|
begin
|
||||||
getprocInputHandler.removeProcess(TProcess(sender));
|
getprocInputHandler.removeProcess(TProcess(sender));
|
||||||
|
ChDir(fRunnerOldCwd);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCENativeProject.compProcOutput(proc: TProcess);
|
procedure TCENativeProject.compProcOutput(proc: TProcess);
|
||||||
|
|
Loading…
Reference in New Issue