Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cruft Cleaner for QB64PE Windows installations
#1
In the QB64PE v3.10.0 announcement thread @RhoSigma mentioned 3 MinGW directories which add a lot of unnecessary weight to a QB64PE installation on Windows (something like 155 megabytes spread across 15000 files).

@Kernelpanic posted a VB Script file for removing those directories, and I posted a batch file to do the same.

Why did neither of us think to post a program in the language of the forum?

I dunno, but here's an attempt to set things right.

This is a useful, totally optional program which can double as a test of successful QB64PE installation.


Code: (Select All)
Option _Explicit

'2023.12.29, J.S.Race.  Public Domain.
'Have fun with it, because I'm done with it.



Dim ccomp$, yupok$
ccomp$ = ".\internal\c\c_compiler\"


Cls


'Verify that we're on Windoze....
'Old joke: "A computer is like air conditioning - it becomes useless when you open Windows" --Linus Torvalds
If Left$(_OS$, 9) <> "[WINDOWS]" Then
    Print: Print "Sorry, this program is only for Windows"
    End
End If


'Verify that we're in the QB64PE directory....
If Not (_FileExists(".\qb64pe.exe")) Then
    Print: Print "Sorry, this program must be run from the directory which contains 'qb64pe.exe'"
    End
End If


Print "***********************************************************************"
Print "* This program will delete three MinGW GCC directories which are      *"
Print "* not required for QB64PE operation.                                  *"
Print "*                                                                     *"
Print "* These directories contain about 15000 files and consume about 150   *"
Print "* megabytes of disk space.                                            *"
Print "*                                                                     *"
Print "* These directories and the files they contain are required for legal *"
Print "* distribution of GCC and QB64PE, but you may safely and legally      *"
Print "* delete them from your own personal installation.                    *"
Print "***********************************************************************"
Print
Input "Enter 'Y' (uppercase only) to proceed: ", yupok$


If yupok$ = "Y" Then
    REMOVE_DIR (ccomp$ + "licenses")
    REMOVE_DIR (ccomp$ + "opt")
    REMOVE_DIR (ccomp$ + "share")
Else
    Print "Operation aborted by user."
End If

Print
Print
End



Sub REMOVE_DIR (D$)
    Dim O$
    'QB64's "RMDIR" will not delete non-empty directories which means
    'we would need to walk the tree of subdirectories deleting all files
    'and subdirs contained within those directories before deleting the
    'directories themselves... if we use QB64 commands only.
    'Instead of doing that, we will let Windows handle all the gory details....
    If _DirExists(D$) Then
        O$ = "RD /Q /S " + Chr$(34) + D$ + Chr$(34) '("RD /Q /S" is silent, but deadly.  Handle with care.)
        Print O$
        Shell _Hide O$
    Else
        Print "Directory not found "; Chr$(34); D$; Chr$(34)
    End If
End Sub
Reply
#2
Well: a little change to do:

REMOVE_DIR (ccomp$ + "license")
to
REMOVE_DIR (ccomp$ + "licenses")

Thanks for this information ! Idea
Simply is also to use the good old windows explorer to kill theese unused directories:
...\internal\c\c_compiler\licenses
...\internal\c\c_compiler\opt
... \internal\c\c_compiler\share  

Quote:
Why not yes ?
Reply
#3
(12-29-2023, 03:55 PM)euklides Wrote: Well: a little change to do:

REMOVE_DIR (ccomp$ + "license")
to
REMOVE_DIR (ccomp$ + "licenses")

Thanks for this information ! Idea
Simply is also to use the good old windows explorer to kill theese unused directories:
...\internal\c\c_compiler\licenses
...\internal\c\c_compiler\opt
... \internal\c\c_compiler\share  

Quote:
Good catch, thanks!

Rather than unzipping a fresh copy of PE I simply recreated those directories for program testing, and I recreated and deleted the wrong directory!

I had it right in my original batch file which I used as pseudo-code for the PE version.  (scratching my head)  Editing mistake I guess.

Fixed in the source above.
Reply
#4
Works great! Thanks! - The WSH script was easier for me to create.  Rolleyes
Reply




Users browsing this thread: 1 Guest(s)