dharple / detox

Tames problematic filenames
BSD 3-Clause "New" or "Revised" License
332 stars 19 forks source link

Is there a way to pass a custom TBL file to a filter, e.g. `safe` #84

Closed delphym closed 2 years ago

delphym commented 3 years ago

Hello there,

Fantastic utility, btw:)

Just looking how to change the default behaviour (say to keep some chars unchanged) as explained in #79 All is great, but I don't like to overwrite the master save.tbl file, but I'd prefer to customise it to my own save_to_keep_some.tbl which I can use in my ~/.detoxrc defined sequence. But I'm doing either something what is not supported at all, or not doing it quite right.

So, say, I created a copy of /.../safe.tbl and named it /usr/local/share/detox/safe_keep_some.tbl (which I modified to my liking). Then created a sequence in ~/detoxrc like this:

sequence "utf_8_keepSome" {
         utf_8;
         safe {safe_keep_some.tbl;};
         wipeup;
};

But running a detox now with any sequence will result into:

ζ detox -n -v -s utf_8 /Volumes/sda2/Videos/Films/ > /tmp/det.out                                                                                                                                              
detox: error parsing config file /Users/dm/.detoxrc: syntax error
    line 91: safe

Note I'm on macOs Mojave, and installed latest stable detox v1.4.5 via Homebrew.

dennis3484 commented 3 years ago

Hi @delphym,

also on macOS and installed detox 1.4.5 via Homebrew.

The manpage of detoxrc was very helpful to get it working: man detoxrc

/usr/local/Cellar/detox/1.4.5/etc/detoxrc

...

sequence "dennis" {
        safe {
                filename "/usr/local/Cellar/detox/1.4.5/share/detox/dennis.tbl";
        };
};

...

/usr/local/Cellar/detox/1.4.5/share/detox/dennis.tbl

start

0x2f        -   # /
0x3a        -   # :
0x7c        -   # |

end
delphym commented 3 years ago

Thanks for providing this. To be honest I didn't thing I need to provide absolute path, especially if it does coexist with the other tbl files. But sounds promising!

dharple commented 2 years ago

Hello.

Thank you @dennis3484 for answering the question.

You're correct, @delphym, that you can leave off the absolute path as long as the table is in /usr/share/detox/, /usr/local/share/detox/, or any custom installation location provided while running ./configure.

Doug