Warn user if z's datafile path is a directory.

Cause this means z will fill up the directory with temp files, and not
work.
This commit is contained in:
rupa committed 2013-03-28 23:30:55 -04:00
1 parent a41f9c6ea7
commit df34a871cb
3 files changed
+8 -2

No files matched your search

+2 -1
View File
@@ -120,7 +120,8 @@ ENVIRONMENT
FILES
Data is stored in $HOME/.z. This can be overridden by setting the
$_Z_DATA environment variable.
$_Z_DATA environment variable. When initialized, z will raise an error
if this path is a directory, and not function correctly.
A man page (z.1) is provided.
+2 -1
View File
@@ -144,7 +144,8 @@ Directories must be full paths without trailing slashes.
.SH
FILES
Data is stored in \fB$HOME/.z\fR. This can be overridden by setting the
\fB$_Z_DATA\fR environment variable.
\fB$_Z_DATA\fR environment variable. When initialized, \fBz\fR will raise an
error if this path is a directory, and not function correctly.
.P
A man page (\fBz.1\fR) is provided.
.SH
+4
View File
@@ -27,6 +27,10 @@ case $- in
*) echo 'ERROR: z.sh is meant to be sourced, not directly executed.'
esac
[ -d "${_Z_DATA:-$HOME/.z}" ] && {
echo "ERROR: z.sh's datafile (${_Z_DATA:-$HOME/.z}) is a directory."
}
_z() {
local datafile="${_Z_DATA:-$HOME/.z}"