mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 11:25:08 +00:00
Add "Save EXE in the source folder" to the Run menu.
(Windows only for now) When active, this new setting will instruct the compiler to save the .EXE in the same folder as the source file. If the current program is not yet saved, the .EXE is placed in the same folder as QB64.EXE, as usual. Also: - When "Make EXE only (F11)" is used, the status area will show "Location: " and a link to the folder where the .EXE was saved. Clicking it launches Windows Explorer.
This commit is contained in:
parent
86f79d8b29
commit
8f67d40330
5 changed files with 68 additions and 11 deletions
|
@ -7,6 +7,7 @@ DIM SHARED IDE_Index$
|
||||||
DIM SHARED LoadedIDESettings AS INTEGER
|
DIM SHARED LoadedIDESettings AS INTEGER
|
||||||
DIM SHARED MouseButtonSwapped AS _BYTE
|
DIM SHARED MouseButtonSwapped AS _BYTE
|
||||||
DIM SHARED PasteCursorAtEnd AS _BYTE
|
DIM SHARED PasteCursorAtEnd AS _BYTE
|
||||||
|
DIM SHARED SaveExeWithSource AS _BYTE
|
||||||
|
|
||||||
IF LoadedIDESettings = 0 THEN
|
IF LoadedIDESettings = 0 THEN
|
||||||
'We only want to load the file once when QB64 first starts
|
'We only want to load the file once when QB64 first starts
|
||||||
|
@ -117,8 +118,20 @@ IF LoadedIDESettings = 0 THEN
|
||||||
PasteCursorAtEnd = 0
|
PasteCursorAtEnd = 0
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF INSTR(_OS$, "WIN") THEN
|
result = ReadConfigSetting("SaveExeWithSource", value$)
|
||||||
|
IF result THEN
|
||||||
|
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
||||||
|
SaveExeWithSource = -1
|
||||||
|
ELSE
|
||||||
|
SaveExeWithSource = 0
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "SaveExeWithSource", "FALSE"
|
||||||
|
END IF
|
||||||
|
ELSE
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "SaveExeWithSource", "FALSE"
|
||||||
|
SaveExeWithSource = 0
|
||||||
|
END IF
|
||||||
|
|
||||||
|
IF INSTR(_OS$, "WIN") THEN
|
||||||
result = ReadConfigSetting("IDE_AutoPosition", value$)
|
result = ReadConfigSetting("IDE_AutoPosition", value$)
|
||||||
IF result THEN
|
IF result THEN
|
||||||
IF UCASE$(value$) = "TRUE" OR ABS(VAL(value$)) = 1 THEN
|
IF UCASE$(value$) = "TRUE" OR ABS(VAL(value$)) = 1 THEN
|
||||||
|
|
|
@ -3,5 +3,5 @@ DIM SHARED BuildNum AS STRING
|
||||||
Version$ = "1.000"
|
Version$ = "1.000"
|
||||||
'BuildNum format is YYYYMMDD/id, where id is a ever-increasing
|
'BuildNum format is YYYYMMDD/id, where id is a ever-increasing
|
||||||
'integer. If you make a change, update the date and increase the id!
|
'integer. If you make a change, update the date and increase the id!
|
||||||
BuildNum$ = "20160621/20"
|
BuildNum$ = "20160621/21"
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,7 @@ DIM SHARED menusize(1 TO 10)
|
||||||
DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER
|
DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER
|
||||||
DIM SHARED ideeditmenuID AS INTEGER
|
DIM SHARED ideeditmenuID AS INTEGER
|
||||||
DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER
|
DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER
|
||||||
|
DIM SHARED RunMenuID AS INTEGER, RunMenuSaveExeWithSource AS INTEGER
|
||||||
DIM SHARED menubar$, idecontextualSearch$
|
DIM SHARED menubar$, idecontextualSearch$
|
||||||
DIM SHARED ideundocombo, ideundocombochr, idenoundo, idemergeundo
|
DIM SHARED ideundocombo, ideundocombochr, idenoundo, idemergeundo
|
||||||
DIM SHARED idealthighlight, ideentermenu
|
DIM SHARED idealthighlight, ideentermenu
|
||||||
|
|
|
@ -245,11 +245,19 @@ IF idelaunched = 0 THEN
|
||||||
|
|
||||||
menusize(m) = i - 1
|
menusize(m) = i - 1
|
||||||
|
|
||||||
m = m + 1: i = 0
|
m = m + 1: i = 0: RunMenuID = m
|
||||||
menu$(m, i) = "Run": i = i + 1
|
menu$(m, i) = "Run": i = i + 1
|
||||||
menu$(m, i) = "#Start F5": i = i + 1
|
menu$(m, i) = "#Start F5": i = i + 1
|
||||||
menu$(m, i) = "Modify #COMMAND$...": i = i + 1
|
menu$(m, i) = "Modify #COMMAND$...": i = i + 1
|
||||||
menu$(m, i) = "-": i = i + 1
|
menu$(m, i) = "-": i = i + 1
|
||||||
|
IF INSTR(_OS$, "WIN") THEN
|
||||||
|
RunMenuSaveExeWithSource = i
|
||||||
|
menu$(m, i) = "Save EXE in the source #folder": i = i + 1
|
||||||
|
IF SaveExeWithSource THEN
|
||||||
|
menu$(RunMenuID, RunMenuSaveExeWithSource) = CHR$(7) + menu$(RunMenuID, RunMenuSaveExeWithSource)
|
||||||
|
ENDIF
|
||||||
|
menu$(m, i) = "-": i = i + 1
|
||||||
|
END IF
|
||||||
menu$(m, i) = "Start (#Detached) Ctrl+F5": i = i + 1
|
menu$(m, i) = "Start (#Detached) Ctrl+F5": i = i + 1
|
||||||
IF os$ = "LNX" THEN
|
IF os$ = "LNX" THEN
|
||||||
menu$(m, i) = "Make E#xecutable Only F11": i = i + 1
|
menu$(m, i) = "Make E#xecutable Only F11": i = i + 1
|
||||||
|
@ -264,7 +272,6 @@ IF idelaunched = 0 THEN
|
||||||
menu$(m, i) = "Make #Android Project": i = i + 1
|
menu$(m, i) = "Make #Android Project": i = i + 1
|
||||||
IF IdeAndroidMenu THEN menusize(m) = i - 1
|
IF IdeAndroidMenu THEN menusize(m) = i - 1
|
||||||
|
|
||||||
|
|
||||||
m = m + 1: i = 0: OptionsMenuID = m
|
m = m + 1: i = 0: OptionsMenuID = m
|
||||||
menu$(m, i) = "Options": i = i + 1
|
menu$(m, i) = "Options": i = i + 1
|
||||||
menu$(m, i) = "#Display...": i = i + 1
|
menu$(m, i) = "#Display...": i = i + 1
|
||||||
|
@ -633,6 +640,17 @@ IF skipdisplay = 0 THEN
|
||||||
PRINT "Executable file created";
|
PRINT "Executable file created";
|
||||||
ELSE
|
ELSE
|
||||||
PRINT ".EXE file created";
|
PRINT ".EXE file created";
|
||||||
|
IF SaveExeWithSource THEN
|
||||||
|
LOCATE idewy - 2, 2
|
||||||
|
PRINT "Location: ";
|
||||||
|
COLOR 11, 1
|
||||||
|
IF path.exe$ = "" THEN path.exe$ = _STARTDIR$ + pathsep$
|
||||||
|
IF POS(0) + LEN(path.exe$) > idewx THEN
|
||||||
|
PRINT "..."; RIGHT$(path.exe$, idewx - 15);
|
||||||
|
ELSE
|
||||||
|
PRINT path.exe$;
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
@ -1249,6 +1267,7 @@ DO
|
||||||
IF mX >= 2 AND mX <= idewx AND mY >= idewy - 3 AND mY <= idewy - 1 THEN
|
IF mX >= 2 AND mX <= idewx AND mY >= idewy - 3 AND mY <= idewy - 1 THEN
|
||||||
IF SCREEN(mY, mX, 1) = 11 + 1 * 16 THEN
|
IF SCREEN(mY, mX, 1) = 11 + 1 * 16 THEN
|
||||||
IF idefocusline THEN idecx = 1: AddQuickNavHistory idecy: idecy = idefocusline: ideselect = 0: GOTO specialchar
|
IF idefocusline THEN idecx = 1: AddQuickNavHistory idecy: idecy = idefocusline: ideselect = 0: GOTO specialchar
|
||||||
|
SHELL _DONTWAIT "EXPLORER " + QuotedFilename$(path.exe$)
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
@ -3837,6 +3856,20 @@ DO
|
||||||
GOTO ideloop
|
GOTO ideloop
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
IF RIGHT$(menu$(m, s), 30) = "Save EXE in the source #folder" THEN
|
||||||
|
PCOPY 2, 0
|
||||||
|
SaveExeWithSource = NOT SaveExeWithSource
|
||||||
|
if SaveExeWithSource then
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "SaveExeWithSource", "TRUE"
|
||||||
|
menu$(RunMenuID, RunMenuSaveExeWithSource) = CHR$(7) + "Save EXE in the source #folder"
|
||||||
|
else
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "SaveExeWithSource", "FALSE"
|
||||||
|
menu$(RunMenuID, RunMenuSaveExeWithSource) = "Save EXE in the source #folder"
|
||||||
|
end if
|
||||||
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
|
GOTO ideloop
|
||||||
|
END IF
|
||||||
|
|
||||||
IF menu$(m, s) = "#Code layout..." THEN
|
IF menu$(m, s) = "#Code layout..." THEN
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
retval = idelayoutbox
|
retval = idelayoutbox
|
||||||
|
|
|
@ -205,6 +205,7 @@ NEXT
|
||||||
|
|
||||||
|
|
||||||
DIM SHARED extension AS STRING
|
DIM SHARED extension AS STRING
|
||||||
|
DIM SHARED path.exe$
|
||||||
extension$ = ".exe"
|
extension$ = ".exe"
|
||||||
IF os$ = "LNX" THEN extension$ = "" 'no extension under Linux
|
IF os$ = "LNX" THEN extension$ = "" 'no extension under Linux
|
||||||
|
|
||||||
|
@ -934,12 +935,18 @@ IF C = 9 THEN 'run
|
||||||
|
|
||||||
'locate accessible file and truncate
|
'locate accessible file and truncate
|
||||||
f$ = file$
|
f$ = file$
|
||||||
|
|
||||||
|
path.exe$ = ""
|
||||||
|
IF SaveExeWithSource THEN
|
||||||
|
IF LEN(ideprogname) THEN path.exe$ = idepath$ + pathsep$
|
||||||
|
END IF
|
||||||
|
|
||||||
i = 1
|
i = 1
|
||||||
nextexeindex:
|
nextexeindex:
|
||||||
IF _FILEEXISTS(file$ + extension$) THEN
|
IF _FILEEXISTS(path.exe$ + file$ + extension$) THEN
|
||||||
E = 0
|
E = 0
|
||||||
ON ERROR GOTO qberror_test
|
ON ERROR GOTO qberror_test
|
||||||
KILL file$ + extension$
|
KILL path.exe$ + file$ + extension$
|
||||||
ON ERROR GOTO qberror
|
ON ERROR GOTO qberror
|
||||||
IF E = 1 THEN
|
IF E = 1 THEN
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
@ -948,6 +955,8 @@ IF C = 9 THEN 'run
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
IF path.exe$ = "" THEN path.exe$ = "..\..\"
|
||||||
|
|
||||||
'inform IDE of name change if necessary (IDE will respond with message 9 and corrected name)
|
'inform IDE of name change if necessary (IDE will respond with message 9 and corrected name)
|
||||||
IF i <> 1 THEN
|
IF i <> 1 THEN
|
||||||
sendc$ = CHR$(12) + file$
|
sendc$ = CHR$(12) + file$
|
||||||
|
@ -1104,10 +1113,10 @@ IF C = 9 THEN 'run
|
||||||
'execute program
|
'execute program
|
||||||
|
|
||||||
IF iderunmode = 1 THEN
|
IF iderunmode = 1 THEN
|
||||||
IF os$ = "WIN" THEN SHELL _DONTWAIT QuotedFilename$(CHR$(34) + file$ + extension$ + CHR$(34)) + ModifyCOMMAND$
|
IF os$ = "WIN" THEN SHELL _DONTWAIT QuotedFilename$(CHR$(34) + path.exe$ + file$ + extension$ + CHR$(34)) + ModifyCOMMAND$
|
||||||
IF os$ = "LNX" THEN SHELL _DONTWAIT QuotedFilename$("./" + file$ + extension$) + ModifyCOMMAND$
|
IF os$ = "LNX" THEN SHELL _DONTWAIT QuotedFilename$("./" + file$ + extension$) + ModifyCOMMAND$
|
||||||
ELSE
|
ELSE
|
||||||
IF os$ = "WIN" THEN SHELL QuotedFilename$(CHR$(34) + file$ + extension$ + CHR$(34)) + ModifyCOMMAND$
|
IF os$ = "WIN" THEN SHELL QuotedFilename$(CHR$(34) + path.exe$ + file$ + extension$ + CHR$(34)) + ModifyCOMMAND$
|
||||||
IF os$ = "LNX" THEN SHELL QuotedFilename$("./" + file$ + extension$) + ModifyCOMMAND$
|
IF os$ = "LNX" THEN SHELL QuotedFilename$("./" + file$ + extension$) + ModifyCOMMAND$
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
@ -11739,7 +11748,7 @@ IF os$ = "WIN" THEN
|
||||||
a$ = LEFT$(a$, x - 1) + libqb$ + RIGHT$(a$, LEN(a$) - x + 1)
|
a$ = LEFT$(a$, x - 1) + libqb$ + RIGHT$(a$, LEN(a$) - x + 1)
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
a$ = a$ + QuotedFilename$("..\..\" + file$ + extension$)
|
a$ = a$ + QuotedFilename$(path.exe$ + file$ + extension$)
|
||||||
|
|
||||||
ffh = FREEFILE
|
ffh = FREEFILE
|
||||||
OPEN tmpdir$ + "recompile_win.bat" FOR OUTPUT AS #ffh
|
OPEN tmpdir$ + "recompile_win.bat" FOR OUTPUT AS #ffh
|
||||||
|
@ -12077,7 +12086,8 @@ IF os$ = "LNX" THEN
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF No_C_Compile_Mode THEN compfailed = 0: GOTO No_C_Compile
|
IF No_C_Compile_Mode THEN compfailed = 0: GOTO No_C_Compile
|
||||||
IF _FILEEXISTS(file$ + extension$) THEN compfailed = 0 ELSE compfailed = 1 'detect compilation failure
|
IF LEFT$(path.exe$, 2) = ".." THEN path.exe$ = ""
|
||||||
|
IF _FILEEXISTS(path.exe$ + file$ + extension$) THEN compfailed = 0 ELSE compfailed = 1 'detect compilation failure
|
||||||
|
|
||||||
IF compfailed THEN
|
IF compfailed THEN
|
||||||
IF idemode THEN
|
IF idemode THEN
|
||||||
|
|
Loading…
Reference in a new issue