Skip to content

Conversation

jmbeach
Copy link

@jmbeach jmbeach commented Aug 31, 2025

Small change to create the resurrect folder if it doesn't exist.

Without this, the resurrect folder might get created in a folder the user doesn't expect. Ex: for me on my mac, the resurrect folder gets created at: .local/share/tmux/resurrect, but I thought it would be at ~/.tmux/resurrect

I also got rid of the logic to fallback to "${XDG_DATA_HOME:-$HOME/.local/share}"/tmux/resurrect if default_resurrect_dir doesn't exist since it would make the logic a little more complicated to implement:

@@ -1,8 +1,4 @@
-if [ -d "$HOME/.tmux/resurrect" ]; then
-        default_resurrect_dir="$HOME/.tmux/resurrect"
-else
-        default_resurrect_dir="${XDG_DATA_HOME:-$HOME/.local/share}"/tmux/resurrect
-fi
+default_resurrect_dir="$HOME/.tmux/resurrect"

The problem is that the default folder only doesn't exist because it hasn't ever been created.

I figure this isn't really an issue though since users can already override the default by setting the @resurrect-dir setting.

Small change to create the resurrect folder if it doesn't exist.

Without this, the resurrect folder might get created in a folder the
user doesn't expect. Ex: for me on my mac, the resurrect folder gets
created at: `.local/share/tmux/resurrect`, but I thought it would be at
`~/.tmux/resurrect`

I also got rid of the logic to fallback to `"${XDG_DATA_HOME:-$HOME/.local/share}"/tmux/resurrect`
if `default_resurrect_dir` doesn't exist since it would make the logic a
little more complicated to implement:

```diff
@@ -1,8 +1,4 @@
-if [ -d "$HOME/.tmux/resurrect" ]; then
-        default_resurrect_dir="$HOME/.tmux/resurrect"
-else
-        default_resurrect_dir="${XDG_DATA_HOME:-$HOME/.local/share}"/tmux/resurrect
-fi
+default_resurrect_dir="$HOME/.tmux/resurrect"
````

The problem is that the default folder only doesn't exist because it
hasn't ever been created.

I figure this isn't really an issue though since users can already
override the default by setting the `@resurrect-dir` setting.
@@ -98,9 +94,15 @@ pane_content_files_restore_from_archive() {

resurrect_dir() {
if [ -z "$_RESURRECT_DIR" ]; then
local path="$(get_tmux_option "$resurrect_dir_option" "$default_resurrect_dir")"
local path
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes shellcheck lint: Declare and assign separately to avoid masking return values (SC2155)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant