/tmp/kde-$USER/ offenders

Andras Mantia amantia at virtualartisans.com
Thu Dec 12 11:09:58 GMT 2002


I have an idea about how to solve the problem, when the app crashes. In the 
majority of the cases the tmp files will remain there. What I think would be 
nice is to keep track of which app (using which pid) opened the corresponding 
tmp files. E.g myApp creates tmp files like "myAppxxxxx.tmp". There will be 
another file which holds the following info:

myApp:pid_no:myApp1234.tmp
myApp:pid_no:myApp5678.tmp

When myApp starts it can look into this file for entries which starts with 
myApp, and if there is no myApp running with pid_no, then it can remove the 
files. Now the whole thing (tracking the open files and removing them) could 
be done on kdelibs level, let's say in KTempFile. Adding/deleting items in 
the above file is easy for it, and it may have a static 
KTempFile::cleanTmp(appName, appPid, filePrefix, fileExtension) method, which 
will look up this file, and remove all entries (and the file corresponding to 
the entry) which start with appName, and there is no process with appPid 
running and the file name honours the 
<filePrefix><six letters><fileExtension>
name.

Is this a walkable way?

Andras




More information about the kde-core-devel mailing list