Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Deprecated: Function create_function() is deprecated in /sites/ on line 104 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /sites/ on line 845 Deprecated: Function create_function() is deprecated in /sites/ on line 111 FS#8637 : make disktidy files configurable



FS#8637 - make disktidy files configurable

Attached to Project: Rockbox
Opened by x (vmh) - Sunday, 24 February 2008, 20:17 GMT
Last edited by Jonathan Gordon (jdgordon) - Sunday, 18 May 2008, 07:27 GMT
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch makes disktidy plugin read the files/directories to clean from a configuration file.
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Sunday, 18 May 2008, 07:27 GMT
Reason for closing:  Accepted
Additional comments about closing:  any volanteers to fix the manual?
Comment by x (vmh) - Monday, 25 February 2008, 07:58 GMT
- clean up
- move configuration file into the patch file
Comment by Rosso Maltese (asettico) - Thursday, 28 February 2008, 16:50 GMT
Using the DAP from Gnome, there is also "/.Trash*".
Comment by x (vmh) - Thursday, 28 February 2008, 21:28 GMT
The intention for this patch is to make disktidy easily extensible. I just included the files to clean in the config file which are already in the actual disktidy.

In your case, you can just add the following lines into the 'disktidy.cfg' file:

Here are some explanations:
- directories are marked with an ending '/' (I assume .Trash is a directory)
- all the entries have wildcards (e.g. '.Trash' has the meaning of '.Trash*')
Comment by x (vmh) - Saturday, 15 March 2008, 22:59 GMT
disktidy will create a sample cfg file if none can be found. This way the cfg doesn't need to be included in the standard build and the user's cfg file won't get overwritten on every update.
Comment by Alexander Papst (DerPapst) - Monday, 21 April 2008, 21:29 GMT
Sync to SVN (r17210)
* Now follows the coding guidelines better
* Added the Linux introduced r17210 (and .Trash-username)
Comment by Alexander Papst (DerPapst) - Tuesday, 22 April 2008, 02:16 GMT
Sync to r17211

Use explicit Wildcards (*) instead of implicit ones.
To delete all files of the type "._random.bla" you have to add "._*" to the config file. Same goes for directories. In order to delete all gnome trash dirs add ".Trash*/".

Updated build in config file to use explicit wildcards.
Comment by Alexander Papst (DerPapst) - Tuesday, 22 April 2008, 10:01 GMT
Oops, i misunderstood something... minor change to configuration file to remove .Trash-username/ folders and not files ;-)
Comment by Alexander Papst (DerPapst) - Tuesday, 22 April 2008, 16:19 GMT
Add "Reset Configuration File" menu point.
Comment by Robert Menes (RMenes379) - Tuesday, 22 April 2008, 17:11 GMT
Fixes warnings in compiler.
Comment by Jonathan Gordon (jdgordon) - Thursday, 24 April 2008, 13:23 GMT
I've taken your customization part and made it a nicer UI (I hope :p )...
so, this patch is against svn, although I really like your wildcard matching so that should get dumped into this...

disctidy is now a viewer for .dtdy files which are in the format <string>: <yes/no> where string is the filename or directory (or special type where it starts with a <). if its a directory it needs to end in /
yes/no means it should be removed.
the "Files to Clean" item now opens up a list of all the types from either the hard coded defaults, or the .dtdy. selecting any will toggle it (I've used the cursor icon, but not sure thats the best one).
choosing < ALL > selects all, < NONE > selects none. any of the other special ones toggles all the items untill the next header.
to exit that screen press the usual list cancel button (left arrow/previous on 99% of targets)

if that screen is changed at all you will be prompted to save the changes before exiting...

Comment by x (vmh) - Thursday, 24 April 2008, 18:25 GMT
Nice UI!

Some remarks:
- I don't have a MAC but without wildcard a file with the name ._ makes no sense.
- Default should be <All> selected, not none (I don't think an ordinary user want to fuss about configuration)
- Don't like it as a "viewer"
- viewer.config is missing in your patch
- What's the purpose of <Other>?
Comment by Jonathan Gordon (jdgordon) - Friday, 25 April 2008, 00:35 GMT
- I dont use mac enough to know about the ._... and the wildcard stuff will be merged in if we decide to go with this
- debatable
- why?
- its the first hunk of the patch
- to put other files under
Comment by Alexander Papst (DerPapst) - Friday, 25 April 2008, 03:32 GMT
Added wildcards back.

Further suggestions:
* Add a trailing "/" to directories in the "Files To Clean" menu
* Select all files by default (done in this patch too)
* Add icon infront of the < OS > items (maybe the folder one as you suggested)

Comment by Jonathan Gordon (jdgordon) - Friday, 09 May 2008, 02:26 GMT
SO I think the only thing holding this back is because some people dont like it acting as a viewer (which I dont undertsand?)
it never does anything automatically, the viewer part is just to load the defaults, having it show up in the open with menu isnt great, but unless we add a way to exclude plugins from that I think its fine.
Comment by Linus Nielsen Feltzing (linusnielsen) - Friday, 09 May 2008, 08:18 GMT
I must say that I don't really understand why it is a viewer. Could you explain?
Comment by Jonathan Gordon (jdgordon) - Saturday, 10 May 2008, 08:46 GMT
the point of the viewer was that users could setup their windows removal file, or their mac file and then just run the plugin and not worry about making sure the correct files are removed.

this attached patch removes the viewer part and adds Desktop.ini
I think all files should default to being removed
Comment by x (vmh) - Monday, 12 May 2008, 08:28 GMT
You removed too many code lines in the last patch (disktidy.3.patch). It's not configurable anymore ("Files to Clean" is empty -> tidy_type_count is always 0) ...
Comment by Eddy (bascule) - Tuesday, 13 May 2008, 14:45 GMT
This patch is what I've been waiting for, as I currently patch my disktidy to delete all the standard Sansa OF directories.

I've just patched with the last 'viewer-enabled' version (disktidy_2.patch) and I think the UI for selecting the required files is excellent. Bring back the viewer!

The only bit I don't understand is how to have *my* hand-crafted *.dtdy file used as the default. I can browse to the file and 'play' it, thus starting disktidy with my settings present. However, this is in /.rockbox and therefore not intended to be browsed to by users. If I just start disktidy from the [Main] > Plugins > Applications menu, is uses the hard-coded defaults...
Comment by Jonathan Gordon (jdgordon) - Tuesday, 13 May 2008, 14:58 GMT
seems you cant... that can be put back in if the viewer part comes back
Comment by Eddy (bascule) - Tuesday, 13 May 2008, 15:42 GMT
I'm confused. I *was* using the viewer-enabled version (disktidy_2.patch) :P

Or were you referring to Vuong Minh's comment about not being able to configure it at all now...?
Comment by Linus Nielsen Feltzing (linusnielsen) - Wednesday, 14 May 2008, 09:22 GMT
So the viewer was there to solve the problem that the config files are located in .rockbox?
Comment by Jonathan Gordon (jdgordon) - Wednesday, 14 May 2008, 11:48 GMT
the viewer was done for 2 reasons.
1) it means that you could have different setups for different OS' (although I've changed my mind and thihng thats pointless now)
2) so we can hardcode a default list which would stay updated in new builds, and would not overwrite users' setups (the alternative was disktidy.conf and disktidy_user.conf, which may be better anyway)
Comment by Eddy (bascule) - Thursday, 15 May 2008, 08:58 GMT
Despite my comments above about the viewer, the simple solution of disktidy.config and disktidy_custom.config (or whatever) would be fine. Certainly it would fit better into the existing Rockbox user interface practices.

Comment by Jonathan Gordon (jdgordon) - Thursday, 15 May 2008, 09:53 GMT
new version..
this one loads disktidy.config (which will be part of the zip, and have every item set to not be removed), then it loads disktidy_custom.config which will add and overwrite the first config. (this way when the default one is updated the user will definatly get the new types)

any volanteers for the manual/wiki fixing?
Comment by Alexander Papst (DerPapst) - Thursday, 15 May 2008, 19:23 GMT
* Show the tailing slashes for directories that the user knows what a dir is and what not (made sure it doesn't save with two slashes in the end :-P)
* Some changes to the config file (one entry was a dir and one was not, added $RECYCLE.BIN/ and desktop.ini)

While adding the 2 new entries i noticed that they didn't show up in the menu. I like the idea however. Maybe it's easier to implement it this way that if disktidy_custom.config doesn't exist create an empty file. When the user adds stuff to it show it under the < Other > section.
Comment by Jonathan Gordon (jdgordon) - Friday, 16 May 2008, 01:15 GMT
DerPapsts' changes without breaking directory searching.
also fixed the problem with new files not being added (the actual problem was the 2nd file was overwriting the first)..

the last thing that I think is needed is for the files from the user config get merged into the defaults, not just appended which is happening now (i mean, < Windows > items from the user one should be put in the < Windows > group.

any takers?
Comment by Eddy (bascule) - Saturday, 17 May 2008, 08:48 GMT
Yep, works a treat now. The only problem I found during compilation, was that the default disktidy.config was created in /rockbox, rather than /rockbox/apps/plugins which is where *make zip* was expecting to find it.
Comment by Jonathan Gordon (jdgordon) - Saturday, 17 May 2008, 08:48 GMT
new version (hopefuly final)

items from _custom are inserted into the correct groups
Comment by Eddy (bascule) - Saturday, 17 May 2008, 09:12 GMT
Has this also fixed the ?bug? that even though all files are set to ': no', they get cleaned anyway?
Haven't got time to try the latest version, but will do soon.