Skip to content

Commit ca61afb

Browse files
committed
Fixed -o parameter to compile and run exe from other directory than main program.
1 parent f9b0643 commit ca61afb

5 files changed

Lines changed: 42 additions & 36 deletions

File tree

src/actionsmodule.pas

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,13 +1054,15 @@ procedure tactionsmo.interruptactonexecute(const Sender: TObject);
10541054

10551055
procedure tactionsmo.continueactonexecute(const Sender: TObject);
10561056
var
1057-
str3: msestring;
1057+
str3, CurrentDir: msestring;
10581058
int1, int2, int3: integer;
10591059
begin
10601060
{$if not defined(darwin) and not defined(dragonfly)}
10611061
nodebugset := False;
10621062
str3 := gettargetfile;//to initialize
10631063
str3 := '';
1064+
CurrentDir := GetCurrentDir;
1065+
10641066
if not fileexists(tosysfilepath(msestring(gettargetfile))) then
10651067
mainfo.setstattext(tosysfilepath(gettargetfile) +
10661068
' ' + lang_actionsmodule[Ord(ac_doesnotexist)] + ' ' +
@@ -1069,6 +1071,10 @@ procedure tactionsmo.continueactonexecute(const Sender: TObject);
10691071
else
10701072
begin
10711073

1074+
str3 := ExtractFilePath(gettargetfile);
1075+
ChDir(str3);
1076+
str3 := '';
1077+
10721078
mainfo.terminategdbserver(True);
10731079

10741080
if debuggerfo.debug_on.tag = 0 then
@@ -1158,6 +1164,7 @@ procedure tactionsmo.continueactonexecute(const Sender: TObject);
11581164
mainfo.setstattext('Running ' + gettargetfile + '...' ,mtk_flat);
11591165
mainfo.runwithoutdebugger;
11601166
{$endif}
1167+
chdir(CurrentDir);
11611168
end;
11621169

11631170

src/commandorform.mfm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object debuggerfo: tdebuggerfo
1313
frame.grip_faceactive.localprops = []
1414
visible = False
1515
bounds_x = 100
16-
bounds_y = 24
16+
bounds_y = 29
1717
bounds_cx = 1232
1818
bounds_cy = 67
1919
container.optionswidget = [ow_mousefocus, ow_tabfocus, ow_arrowfocus, ow_arrowfocusin, ow_arrowfocusout, ow_subfocus, ow_mousetransparent]
@@ -2591,19 +2591,19 @@ object debuggerfo: tdebuggerfo
25912591
FFFFFF0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
25922592
00000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000
25932593
000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000FF
2594-
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFF
2595-
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFFFF
2596-
FFFFFFFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFF
2594+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000008E00000000FFFFFFFFFF
2595+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000008E00000000FFFFFFFFFFFFFFFFFF
2596+
FFFFFFFFFFFFFFFFFFFFFF0000008E00000000FFFFFFFFFFFFFFFFFFFFFFFFFF
25972597
FFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
2598-
FFFFFF0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
2599-
00000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000
2598+
FFFFFF000000DF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
2599+
0000E000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000D800
26002600
000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000FF
2601-
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFF
2602-
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFFFF
2601+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000005500000000FFFFFFFFFF
2602+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000005500000000FFFFFFFFFFFFFFFFFF
26032603
FFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000
2604-
0000000000000000000000000000000000000000000000000000000000000000
2605-
0000000000000000000000000000000000000000000000000000000000000000
2606-
0000000000000000000000000000000000000000000000000000000000000000
2604+
00000000000000000000DE000000000000000000000000000000000000000000
2605+
000000000000FF00000000000000000000000000000000000000000000000000
2606+
0000FF0000000000000000000000000000000000000000000000000000000000
26072607
}
26082608
face.localprops = [fal_image]
26092609
face.template = mainfo.tfacecomp1

src/commandorform_mfm.pas

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ implementation
4141
97,99,101,99,111,109,112,51,32,102,114,97,109,101,46,103,114,105,112,95,
4242
102,97,99,101,97,99,116,105,118,101,46,108,111,99,97,108,112,114,111,112,
4343
115,11,0,7,118,105,115,105,98,108,101,8,8,98,111,117,110,100,115,95,
44-
120,2,100,8,98,111,117,110,100,115,95,121,2,24,9,98,111,117,110,100,
44+
120,2,100,8,98,111,117,110,100,115,95,121,2,29,9,98,111,117,110,100,
4545
115,95,99,120,3,208,4,9,98,111,117,110,100,115,95,99,121,2,67,23,
4646
99,111,110,116,97,105,110,101,114,46,111,112,116,105,111,110,115,119,105,100,
4747
103,101,116,11,13,111,119,95,109,111,117,115,101,102,111,99,117,115,11,111,
@@ -3919,25 +3919,25 @@ implementation
39193919
255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,
39203920
255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,
39213921
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,
3922-
0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
3923-
255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,
3924-
255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,
3922+
0,142,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
3923+
255,255,255,255,255,255,0,0,0,142,0,0,0,0,255,255,255,255,255,255,
3924+
255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,142,0,0,
39253925
0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
39263926
255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,
3927-
255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,
3927+
255,255,255,255,255,255,255,255,255,255,0,0,0,223,0,0,0,0,255,255,
39283928
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,
3929-
0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
3930-
255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,
3929+
0,224,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
3930+
255,255,255,255,255,255,0,0,0,216,0,0,0,0,255,255,255,255,255,255,
39313931
255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,
39323932
0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
3933-
255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,
3934-
255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,
3933+
255,255,0,0,0,85,0,0,0,0,255,255,255,255,255,255,255,255,255,255,
3934+
255,255,255,255,255,255,255,255,255,255,0,0,0,85,0,0,0,0,255,255,
39353935
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,
39363936
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3937+
0,0,0,0,0,0,0,0,0,222,0,0,0,0,0,0,0,0,0,0,
3938+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,
39373939
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3938-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3939-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3940-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3940+
0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
39413941
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,102,97,99,101,
39423942
46,108,111,99,97,108,112,114,111,112,115,11,9,102,97,108,95,105,109,97,
39433943
103,101,0,13,102,97,99,101,46,116,101,109,112,108,97,116,101,7,17,109,

src/make.pas

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ procedure abortdownload;
221221
end;
222222
end;
223223

224-
{$IF DEFINED(WINDOWS) AND (FPC_FULLVERSION >= 30301)}
224+
{$IFDEF WINDOWS}
225225
{$PUSH}
226226
// Force safe -O2 rules exclusively for Windows under FPC trunk
227227
{$OPTIMIZATION LEVEL2}
@@ -555,12 +555,12 @@ function buildmakecommandline(const atag: integer): string;
555555
//str1:= strcompiler;
556556

557557

558-
if (targetfile <> '') and (targpref <> '') then begin
559-
560-
if acompiler <> 3 then
561-
str1:= strcompiler + ' ' + quotefilename(targpref+normalizename(targetfile+strexecext));
562-
563-
end;
558+
if (targetfile <> '') and (acompiler <> 3) then
559+
if (targpref <> '') then
560+
str1:= strcompiler + ' -o' +
561+
quotefilename(targpref+normalizename(targetfile+strexecext))
562+
else str1:= strcompiler;
563+
564564
int2:= high(unitdirs);
565565
int1:= high(unitdirson);
566566
if int1 < int2 then begin
@@ -851,7 +851,7 @@ function customcommandline(const aname: filenamety; const acompiler, acompilerta
851851
result:= ansistring(str1) ;
852852
end;
853853

854-
{$IF DEFINED(WINDOWS) AND (FPC_FULLVERSION >= 30301)}
854+
{$IFDEF WINDOWS}
855855
{$POP}
856856
{$ENDIF}
857857

src/projectoptionsform.pas

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,8 +1353,6 @@ function gettargetfile: filenamety;
13531353
if int1 > 0 then
13541354
strtarget := system.copy(strtarget, 0, int1 - 1);
13551355

1356-
// writeln(projectoptions.o.texp.targetfile);
1357-
13581356
strexecext := '';
13591357

13601358
if (inttypecomp = 2) then
@@ -1382,8 +1380,9 @@ function gettargetfile: filenamety;
13821380
if trim(debugtarget) <> '' then
13831381
Result := objpath(debugtarget)
13841382
else
1385-
Result := objpath(strtarget + strexecext)//o.texp.targetfile
1386-
;
1383+
with projectoptions,o,texp do
1384+
Result := objpath(ExpandFileName(targpref+targetfile+strexecext)); //o.texp.targetfile
1385+
13871386
end;
13881387

13891388
procedure projectoptionstofont(const afont: tfont);

0 commit comments

Comments
 (0)