Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Failing to write to history file if containing directory doesn't exist



On 10/17/07, Richard Hartmann <richih.mailinglist@xxxxxxxxx> wrote:

> On 17/10/2007, Matthew Wozniski <godlygeek@xxxxxxxxx> wrote:

> > But, either way, I'm still against this proposed feature; I still find it
> > to be unnecessary at best.

> I would not want to use it, either. My comments are more geared towards
> 'if one would do it, this could be a good way'.

I still haven't seen a good reason for Zsh to not deal with this error
condition appropriately, besides worries that Zsh start creating
directories.  This argument fails, because we actually asked it to
store a file in that directory, so we probably won't mind if Zsh makes
sure it exists when it's needed.

> An easy, light and scriptable solution that solves 99% of all cases has
> already been hinted at:
>
> export HISTDIR=foo
> mkdir -p $HISTDIR || echo 'Woe is me!'
> export HISTFILE=$HISTDIR/bar

I'm sorry, but how does it solve 99% of all cases?  There are two cases:

1.  $HISTFILE:h exists when writing $HISTFILE
2.  $HISTFILE:h does not exist when writing $HISTFILE

The above solution makes case 1 more likely, sure, but it doesn't solve case 2.



Messages sorted by: Reverse Date, Date, Thread, Author