QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: mrhuman on February 03, 2021, 11:15:09 pm

Title: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 03, 2021, 11:15:09 pm
Some .exe with the .bas file name comes. Is there anyway to automatically delete that when I close qb64? Please tell me as I am very storage space conscious and that file(though only a few kbs) takes up space. Or is there any setting to change so that the code only comes up in a console like q basic 4.5?
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: STxAxTIC on February 03, 2021, 11:20:45 pm
Hm, I never thought about a "delete EXE on exit" feature. Kinda profound...

Is it a matter of clutter in your qb64 folder? Or are you actually keeping track of every last kilobyte on the drive?
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: bplus on February 03, 2021, 11:28:50 pm
Welcome to the forum mrhuman.

I have sorta wished for a delete exe when I am backing up my bas code, the exe's are huge in comparison. I used to keep many backups on one storage disk. Now I have to delete old backups to make room for new, because of exes.

Yeah a simple program could do that for me ;-)) just copy all the files except the exes.
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 03, 2021, 11:33:53 pm
@STxAxTIC
Umm. For both the reasins
I have a lot of apps that hog up space(like adobe animate) so every kB is a lot of storage
As soon as the storage indicator in explorer turns red , I panick like something .
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 03, 2021, 11:50:31 pm
@bplus 
But the exe come in the qb64 folder

If you open the qb64 folder in one side and qb64 in the other and run a program, an exe comes in the folder.
I am asking for a script or something like that to delete them when qb64 is closed or the program is done testing.
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: bplus on February 03, 2021, 11:58:46 pm
@bplus 
But the exe come in the qb64 folder

If you open the qb64 folder in one side and qb64 in the other and run a program, an exe comes in the folder.
I am asking for a script or something like that to delete them when qb64 is closed or the program is done testing.

RE: reasons to get rid of an exe
Yes, I was just talking about my desire to save space when backing up.

RE: reasons to keep an exe
The exe's are handy in my work folders for me, to remind what the heck I was doing without having to load the code back up in the IDE. The exe's are handy for distinguishing version differences I have, again without having to reload the bas code and Run through IDE.  True kind of expensive space wise but now days there is no concern of me loading up my hard drive, ever!
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 04, 2021, 12:11:09 am
@bplus
Oh

Still is it possible to add a feature in the run area something like this...

Run

Create an exe and run
Run in console
Create an exe
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: FellippeHeitor on February 04, 2021, 12:14:58 am
Hello. Because QB64 is a compiler, you will always get an .exe file when you run a program, because it's the only way to run it. If you close the exe, make changes and run again, QB64 will overwrite the existing exe. Deleting it after run would be highly invasive, and generating an .exe every time you wanna run a program that didn't have changes would be counterproductive.
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: bplus on February 04, 2021, 12:18:12 am
Doesn't it also save a little time (compiling) if an exe is already there?
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 04, 2021, 12:21:11 am
But it just overwrites it.
So the same time is taken
I had made some code
Run it
Edited it
And ran in again
It took the same time
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: STxAxTIC on February 04, 2021, 12:22:39 am
Delete after run (the exe) vs. delete after close (qb64.exe) though. But this is just choosing pink vs purple lipstick for a piggish idea. I'm done.

(EDIT: Because what if we're compiling qb64.bas itself?! Mind blown. (Don't take me seriously.))

What I think mrhuman should consider is getting a bigger hard drive.
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 04, 2021, 12:29:52 am
Ok then ,no delete
But about adding a test in console ? That’s a good idea right?
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 04, 2021, 12:31:58 am
Then there should be no worries about the auto delete thing. Right @STxAxTIC ?
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: STxAxTIC on February 04, 2021, 12:35:15 am
I think deleting anything automatically is a pretty bad idea. This should be done manually. If you don't want to do it by hand each time, maybe write a little shell script to clear a folder of *.exe, and then only boot qb64 using that script.

Another idea: Never load a file directly. Only copy the code, and then paste it into the IDE. Then your exe will always be untitled, and you won't get a bunch of copies of it.
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 04, 2021, 12:38:21 am
@STxAxTIC
Let’s just forget about the delete thing.
Adding a test in console or run in console could be considered
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: STxAxTIC on February 04, 2021, 12:40:31 am
I understand what you are asking for, but as Fellippe pointed out, this is not like QB45. When you ask to QB64 to run the code, it *must* generate the exe. The code does not run somewhere "within" the qb64 environment. It's for this reason that certain things aren't included in the modern IDE - such as the F8 key for stepping. That kind of thing is completely undefined here.

tldr: the exe is always created, it's a law
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 04, 2021, 12:43:15 am
@STxAxTIC
Yeah auto deleting is bad.
I thing I lost a video because of windows 10's storage sense thing.

Reply to latest comment
So QB64 is sorta like visual studio? And what I am asking is like I am asking it to not make an exe to test the software
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: STxAxTIC on February 04, 2021, 12:44:49 am
Define "test the software". If any part of that statement means "run" the code, you need the entire exe. Basically how you see it work now is the only way it can work. QB64 is not "like" any other product, really.
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: mrhuman on February 04, 2021, 12:48:03 am
Ok then
Thanks!
To @STxAxTIC
I am marking your reply as the answer
Signing out
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: SMcNeill on February 04, 2021, 01:10:09 am
Write a little program to check your folders for you, run QB64, and then do clean up, if necessary...

Like this one:

Code: QB64: [Select]
  1. _TITLE "QB64 Auto-cleanup"
  2.     FUNCTION load_dir& (s AS STRING)
  3.     FUNCTION has_next_entry& ()
  4.     SUB close_dir ()
  5.     SUB get_next_entry (s AS STRING, flags AS LONG, file_size AS LONG)
  6.  
  7. REDIM Dir(0) AS STRING, File(0) AS STRING
  8. REDIM Dir2(0) AS STRING, File2(0) AS STRING
  9.  
  10. GetFileList _CWD$, Dir(), File()
  11.  
  12. SHELL "QB64.EXE"
  13.  
  14. GetFileList _CWD$, Dir2(), File2()
  15.  
  16. FOR i = 1 TO UBOUND(dir2)
  17.     flag = 0 'not found
  18.     FOR j = 1 TO UBOUND(dir)
  19.         IF Dir2(i) = Dir(j) THEN flag = -1: EXIT FOR
  20.     NEXT
  21.     IF flag = 0 THEN PRINT Dir2(i); " is a new directory."
  22. FOR i = 1 TO UBOUND(File2)
  23.     flag = 0 'not found
  24.     FOR j = 1 TO UBOUND(File)
  25.         IF File2(i) = File(j) THEN flag = -1: EXIT FOR
  26.     NEXT
  27.     IF flag = 0 THEN PRINT File2(i); " is a new file."
  28.  
  29. SUB GetFileList (SearchDirectory AS STRING, DirList() AS STRING, FileList() AS STRING)
  30.     CONST IS_DIR = 1
  31.     CONST IS_FILE = 2
  32.     DIM flags AS LONG, file_size AS LONG
  33.  
  34.     REDIM _PRESERVE DirList(100), FileList(100)
  35.     DirCount = 0: FileCount = 0
  36.  
  37.     IF load_dir(SearchDirectory) THEN
  38.         DO
  39.             length = has_next_entry
  40.             IF length > -1 THEN
  41.                 nam$ = SPACE$(length)
  42.                 get_next_entry nam$, flags, file_size
  43.                 IF flags AND IS_DIR THEN
  44.                     DirCount = DirCount + 1
  45.                     IF DirCount > UBOUND(DirList) THEN REDIM _PRESERVE DirList(UBOUND(DirList) + 100)
  46.                     DirList(DirCount) = nam$
  47.                 ELSEIF flags AND IS_FILE THEN
  48.                     FileCount = FileCount + 1
  49.                     IF FileCount > UBOUND(filelist) THEN REDIM _PRESERVE FileList(UBOUND(filelist) + 100)
  50.                     FileList(FileCount) = nam$
  51.                 END IF
  52.             END IF
  53.         LOOP UNTIL length = -1
  54.         close_dir
  55.     ELSE
  56.     END IF
  57.     REDIM _PRESERVE DirList(DirCount)
  58.     REDIM _PRESERVE FileList(FileCount)
  59.  

Run it, it stores a list of all files and directories in the folder where QB64 is.
The it starts up QB64.
When QB64 ends, it unhides itself and then prints you a list of all the new folders or directories that have appeared in the QB64 folder.

Now, I'm not doing anything with those files or folders, as I don't believe in messing with other folks drives, but all you'd have to do is now KILL them out of existence, if you so desired...
Title: Re: A .exe file pops up in the qb64 directory when running a code
Post by: luke on February 04, 2021, 04:05:08 am
It is not practical to have QB64 delete the executable made when you press F5, because the IDE doesn't know when the program has finished executing.