Allow using '$HOSTNAME' in @resurrect-dir

Closes #197
This commit is contained in:
Bruno Sutic
2017-06-01 17:18:39 +02:00
parent eef844c747
commit fbed36ad0e
3 changed files with 14 additions and 1 deletions

View File

@ -98,11 +98,13 @@ pane_content_files_restore_from_archive() {
resurrect_dir() {
if [ -z "$_RESURRECT_DIR" ]; then
local path="$(get_tmux_option "$resurrect_dir_option" "$default_resurrect_dir")"
echo "${path/#\~/$HOME}" # expands tilde if used with @resurrect-dir
# expands tilde, $HOME and $HOSTNAME if used in @resurrect-dir
echo "$path" | sed "s,\$HOME,$HOME,g; s,\$HOSTNAME,$(hostname),g; s,\~,$HOME,g"
else
echo "$_RESURRECT_DIR"
fi
}
_RESURRECT_DIR="$(resurrect_dir)"
resurrect_file_path() {
if [ -z "$_RESURRECT_FILE_PATH" ]; then
@ -112,6 +114,7 @@ resurrect_file_path() {
echo "$_RESURRECT_FILE_PATH"
fi
}
_RESURRECT_FILE_PATH="$(resurrect_file_path)"
last_resurrect_file() {
echo "$(resurrect_dir)/last"