Skip to content

Be more careful about polluting/deleting directories specified by -t #114

Description

@kayb94

Hi,

thank you for your work on ltx2any, it is really a handy tool for me to write Latex from vim! However, I encountered some unexpected behavior of the -t flag in combination with the -c flag.
I used it roughly like:
ltx2any -t /tmp -c FILE
I thought, the temporary files would be created there and afterwards only those just created files would be deleted. However, everything in /tmp was deleted (except root's files). I think I figured out it should be used like the following:
ltx2any -t /tmp/ltx2any_tmpdir -c FILE
The directory is created, the files are put there, and afterwards everything including the directory is removed -- which again is nice.

What do you think? Would it be better to clarify the behavior by making the description in parameters.rb more clear? Or is the behavior better changed? At least this can be pretty dangerous when doing
ltx2any -t ~ -c ~/dir/FILE.

I was thinking of something like:
Parameter.new(:tmpdir, 't', String, '"#{self[:user_jobname]}#{TMPSUFFIX}"', 'Directory for temporary files. If combined with -c, all contents of the directory including itself is removed afterwards.'),

An even safer approach might be to only accept non-existing directories as parameter (I'd prefer this).

Regards

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions