Skip to content

Update symlink only after the content archive is ready. #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion scripts/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ is_session_grouped() {
# pane content file helpers

pane_contents_create_archive() {
local archive_file="$(pane_contents_archive_file)"
if [ -f "$archive_file" ]; then
mv "$archive_file" "$archive_file"-old
fi
tar cf - -C "$(resurrect_dir)/save/" ./pane_contents/ |
gzip > "$(pane_contents_archive_file)"
gzip > "$archive_file"
rm "$archive_file"-old
}

pane_content_files_restore_from_archive() {
Expand Down
10 changes: 5 additions & 5 deletions scripts/save.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,17 @@ save_all() {
dump_windows >> "$resurrect_file_path"
dump_state >> "$resurrect_file_path"
execute_hook "post-save-layout" "$resurrect_file_path"
if files_differ "$resurrect_file_path" "$last_resurrect_file"; then
ln -fs "$(basename "$resurrect_file_path")" "$last_resurrect_file"
else
rm "$resurrect_file_path"
fi
if capture_pane_contents_option_on; then
mkdir -p "$(pane_contents_dir "save")"
dump_pane_contents
pane_contents_create_archive
rm "$(pane_contents_dir "save")"/*
fi
if files_differ "$resurrect_file_path" "$last_resurrect_file"; then
ln -fs "$(basename "$resurrect_file_path")" "$last_resurrect_file"
else
rm "$resurrect_file_path"
fi
remove_old_backups
execute_hook "post-save-all"
}
Expand Down