tmux-resurrect icon indicating copy to clipboard operation
tmux-resurrect copied to clipboard

Create the default .tmux/resurrect dir if not exists

Open jmbeach opened this issue 3 months ago • 1 comments

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.

jmbeach avatar Aug 31 '25 22:08 jmbeach