diff --git a/src/u_ceproject.pas b/src/u_ceproject.pas index 9514e9d6..b9f0bb9a 100644 --- a/src/u_ceproject.pas +++ b/src/u_ceproject.pas @@ -872,6 +872,14 @@ begin fMsgs.message(usingCompilerInfo(CEProjectCompiler), fAsProjectItf, amcProj, amkInf); fCompilProc.CurrentDirectory := prjpath; fCompilProc.Executable := fCompilerSelector.getCompilerPath(CEProjectCompiler); + if not fCompilProc.Executable.fileExists then + begin + fMsgs.message(format('error, the compiler path for `%s` does not seem valid', + [DCompiler2String[CEProjectCompiler]]), fAsProjectItf, amcProj, amkErr); + fMsgs.message('check menu `Options`, `Compilers Paths`', fAsProjectItf, amcProj, amkHint); + subjProjCompiled(fProjectSubject, fAsProjectItf, false); + exit; + end; fCompilProc.Options := fCompilProc.Options + [poStderrToOutPut, poUsePipes]; fCompilProc.ShowWindow := swoHIDE; fCompilProc.OnReadData:= @compProcOutput; @@ -1144,8 +1152,8 @@ begin else if value = ldc then value := ldmd; CEProjectCompiler := value; - if not sel.isCompilerValid(CEProjectCompiler) then - CEProjectCompiler := dmd; + //if not sel.isCompilerValid(CEProjectCompiler) then + // CEProjectCompiler := dmd; end; initialization diff --git a/src/u_dubproject.pas b/src/u_dubproject.pas index 14bd3ca6..c4835281 100644 --- a/src/u_dubproject.pas +++ b/src/u_dubproject.pas @@ -1107,6 +1107,7 @@ var rargs: TStringList; i: integer; e: string; + d: string; begin if fDubProc.isNotNil and fDubProc.Active then begin @@ -1163,7 +1164,16 @@ begin if (fConfigs.Count <> 1) and (fConfigs[0] <> DubDefaultConfigName) then fDubProc.Parameters.Add('--config=' + fConfigs[fConfigIx]); end; - fDubProc.Parameters.Add('--compiler=' + fCompilerSelector.getCompilerPath(DubCompiler)); + d := fCompilerSelector.getCompilerPath(DubCompiler); + if not d.fileExists then + begin + fMsgs.message(format('error, the compiler path for `%s` does not seem valid', + [DCompiler2String[DubCompiler]]), fAsProjectItf, amcProj, amkErr); + fMsgs.message('check menu `Options`, `Compilers Paths`', fAsProjectItf, amcProj, amkHint); + subjProjCompiled(fProjectSubject, fAsProjectItf, false); + exit; + end; + fDubProc.Parameters.Add('--compiler=' + d); dubBuildOptions.getOpts(fDubProc.Parameters); if (command <> dcBuild) and runArgs.isNotEmpty then begin @@ -1891,13 +1901,13 @@ begin end; procedure setDubCompiler(value: DCompiler); -var - sel: ICompilerSelector; +//var + //sel: ICompilerSelector; begin - sel := getCompilerSelector; + //sel := getCompilerSelector; DubCompiler := value; - if not sel.isCompilerValid(DubCompiler) then - DubCompiler := dmd; + //if not sel.isCompilerValid(DubCompiler) then + // DubCompiler := dmd; end; {$ENDREGION} diff --git a/src/u_interfaces.pas b/src/u_interfaces.pas index b0a20a65..95ac098c 100644 --- a/src/u_interfaces.pas +++ b/src/u_interfaces.pas @@ -490,6 +490,10 @@ type function getCodeFormatting: ICodeFormatting; inline; function getLifeTimeManager: ILifetimeManager; inline; + const + DCompiler2String: array[DCompiler] of string = ('dmd', 'gdc', 'gdmd', 'ldc', 'ldmd', + 'user1', 'user2', 'global'); + implementation {$REGION TMultiDocSubject ----------------------------------------------------} @@ -665,12 +669,9 @@ end; {$ENDREGION} function usingCompilerInfo(value: DCompiler): string; -const - c2id: array[DCompiler] of string = ('dmd', 'gdc', 'gdmd', 'ldc', 'ldmd', - 'user1', 'user2', 'global'); begin result := format('using %s (%s)', - [getCompilerSelector.getCompilerPath(value), c2id[value]]); + [getCompilerSelector.getCompilerPath(value), DCompiler2String[value]]); end; end. diff --git a/src/u_main.pas b/src/u_main.pas index 054ff401..2d90fde4 100644 --- a/src/u_main.pas +++ b/src/u_main.pas @@ -3068,6 +3068,13 @@ begin ldc, ldmd: dmdProc.Executable := fCompilerSelector.getCompilerPath(ldmd); else dmdProc.Executable := fCompilerSelector.getCompilerPath(fRunnablesOptions.compiler); end; + if not dmdProc.Executable.fileExists then + begin + fMsgs.message(format('error, the compiler path for `%s` does not seem valid', + [DCompiler2String[fRunnablesOptions.compiler]]), fDoc, amcEdit, amkErr); + fMsgs.message('check menu `Options`, `Compilers Paths`', fDoc, amcEdit, amkHint); + exit; + end; dmdproc.Parameters.Add(fDoc.fileName); if not asObj then dmdproc.Parameters.Add('-of' + fname + exeExt) @@ -3416,6 +3423,8 @@ begin end; procedure TMainForm.dubFile(outside: boolean); +var + d: string; begin if fDoc.isNil then exit; @@ -3442,9 +3451,15 @@ begin {$ENDIF} fRunProc.XTermProgram:=consoleProgram; end; - if fRunnablesOptions.compiler <> dmd then - fRunProc.Parameters.add('--compiler=' + - fCompilerSelector.getCompilerPath(fRunnablesOptions.compiler)); + d := fCompilerSelector.getCompilerPath(fRunnablesOptions.compiler); + if not d.fileExists then + begin + fMsgs.message(format('error, the compiler path for `%s` does not seem valid', + [DCompiler2String[fRunnablesOptions.compiler]]), fDoc, amcEdit, amkErr); + fMsgs.message('check menu `Options`, `Compilers Paths`', fDoc, amcEdit, amkHint); + exit; + end; + fRunProc.Parameters.add('--compiler=' + d); fRunProc.Parameters.Add(fDoc.fileName); fRunProc.execute; end;