mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 01:46:40 +00:00
load_session: prefer existing session instead of file in cwd
This also adds './' to a file used from the current working dir (in case there is no session with that name), which is required for Bash's `source` to use it (and not look for it in `$PATH`). Fixes https://github.com/jimeh/tmuxifier/issues/69.
This commit is contained in:
@@ -189,9 +189,17 @@ load_window() {
|
|||||||
# - $2: (optional) Override default window name.
|
# - $2: (optional) Override default window name.
|
||||||
#
|
#
|
||||||
load_session() {
|
load_session() {
|
||||||
local file="$1"
|
local file
|
||||||
if [ ! -f "$file" ]; then
|
if [ "${1#*/}" = "$1" ]; then
|
||||||
file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh"
|
# There's no slash in the path.
|
||||||
|
if [ -f "$TMUXIFIER_LAYOUT_PATH/$1.session.sh" ] || [ ! -f "$1" ]; then
|
||||||
|
file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh"
|
||||||
|
else
|
||||||
|
# bash's 'source' requires an slash in the filename to not use $PATH.
|
||||||
|
file="./$1"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
file="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user