Error msg if saved session file doesn't exist

Close #9
This commit is contained in:
Bruno Sutic 2014-08-26 15:52:07 +02:00
parent 732d53cede
commit 81ed0811b4
No known key found for this signature in database
GPG Key ID: 66D96E4F2F7EF26C
2 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@
- saving a new session does not remove the previous one - saving a new session does not remove the previous one
- make the directory where sessions are stored configurable - make the directory where sessions are stored configurable
- support only Tmux v1.9 or greater - support only Tmux v1.9 or greater
- display a nice error message if saved session file does not exist
### v0.0.1, 2014-08-26 ### v0.0.1, 2014-08-26
- started a project - started a project

View File

@ -4,6 +4,14 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh" source "$CURRENT_DIR/helpers.sh"
check_saved_session_exists() {
local saved_session="$(last_session_path)"
if [ ! -f $saved_session ]; then
display_message "Saved session not found!"
exit
fi
}
window_exists() { window_exists() {
local session_name="$1" local session_name="$1"
local window_number="$2" local window_number="$2"
@ -76,6 +84,7 @@ restore_all_sessions() {
main() { main() {
if supported_tmux_version_ok; then if supported_tmux_version_ok; then
check_saved_session_exists
restore_all_sessions restore_all_sessions
fi fi
} }