打扫清理,干净起来
残余临时进程文件夹
A little pre-text..
When you run a gambas program various process folders are (or can be) created related to the process ID. (Application.Handle)
So for example if you program runs and has the process ID of 2345 then the following happens...
-
linux creates a main process folder in /proc/
/proc/2345
-
gambas creates a temp folder (accessed in your application using the Temp() command)
/tmp/gambas.1000/2345
-
gambas JIT (if enabled) creates a temp folder.
/run/user/1000/gambas/2345
-
gtk3 may or not make a folder (depending on components used)
$HOME/.cache/org.gambas.2345
-
webkit may or may not make a folder.
$HOME/.local/share/org.gambas.2345
When your application closes all these folders should automatically delete as the application/libraries clean up.
There are however many things that can stop the cleanup !
-
If the program crashes.
-
If the program is terminated "Killed"
-
The program hard exits when the system shuts down or logs out while it's running.
This includes background programs launched at startup that remain running all the time, they are killed when the system shuts down so may not clean up.
If the cleanup process does not happen then the above mentioned folders could be left behind.
Mostly it will not matter.
-
The folder in /proc/ is removed by the system.
-
The folder in /tmp/gambas.1000/ will clear at reboot.
-
The folder in /run/user/1000/gambas/ will clear at reboot.
If however, your program has made temporary folders in the $HOME folder and does not exit normally then they will not be removed and will accumulate on your drive.
Sadly this cannot really be helped :(
Note: The temporary folders made in home are from GTK+ usage, if your programs uses QT not GTK then these folders are not created)
A simple function like this can be used to keep your disk clean.
It scans the home folder for temporary gambas folders that do not have a matching active process folder ID in /proc/ and deletes them.
Public Sub RemoveObsoleteDirs()
For Each sLocation As String In [User.Home &/ ".cache", User.Home &/ ".local/share"]
For Each sDir As String In Dir(sLocation, "org.gambas.*", gb.Directory) ' List all org.gambas.* folders in sLocation
If Not Exist("/proc" &/ File.Ext(sDir)) Then Shell "rm -rf " & sLocation &/ sDir Wait
Next
Next
End