2008/8/14 João Valverde <[EMAIL PROTECTED]> > Andrea Francia wrote: > >> I created a similar program. A command line interface written in python >> for the trash can. >> The website is http://code.google.com/p/trash-cli/ >> >> May be we can collaborate. >> > > Interesting, thanks. I'll be sure to take a look and contact you if I > can be of use. Unfortunately my knowledge of Python is limited to > skimming some books and code but I've been meaning to dive in sometime.
If you want, you can contribute knowing little of python. You can learn python working on trash-cli. Is this feasible? Better than going through mtab right? How else >> could I >> find mount points for trash folders? How much can be done >> automatically >> when mounting or unmounting volumes? Are there any plans to >> involve HAL >> on this? My ignorance starts to show here... >> >> >> The component that knows the informations about the mount points is the >> kernel. >> There's no need to duplicate these informations in $XDG_DATA_HOME with the >> risk that those are inaccurate or non synchronized. >> >> The kernel communicates the status of the current mount points with >> /etc/mtab and (in some systems) with /proc/mounts. >> >> To parse the /etc/mtab (or the /proc/mounts) file you should use getmnt(2) >> system function that recognizes all the special cases (like spaces in mount >> points) that and a reinvented parser may not consider. >> >> > > Your points are all valid. The problem with mtab is that there is a lot > of cruft in there. It's not straightforward to interpret its contents. > Anyway doing this from the shell would require writing a parser using > getmntent(2) as you mentioned. How do we distinguish which filesystems > are "interesting" from the mntent structure without reading every single > one and checking whether a .Trash* folder exists? Do we go by filesystem > type? You can create a blacklist of fake file system. I a fake filesystem is not in the list just check it the .Trash folders exists. There are a lot of filesystems out there and it seems futile to > keep track of every single one. One possibility is writing a parser in C > that compares the filesystems in /proc/filesystems (I assume "nodev" > means it's a virtual filesystem?) against /etc/mtab and returns the > mount points that have the correct type. Are you sure that all filesystems with nodev are fake filesystems? If you rely on /proc/filesystems your program will work only on those system that have the /proc filesystem available. I think that the blacklist alternative is better. At the present trash-cli doesn't have yet a black-list, simply checks if the .Trash directory exists. This works for me. If you don't have a /net fileststem the blacklist will only speed up the list-trash operation of few milliseconds, I'll implement that only after other things. -- Andrea Francia http://andreafrancia.blogspot.com/
_______________________________________________ xdg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xdg
