feat(defaults): session data in $XDG_STATE_HOME #15583

See: 4f2884e16d

- Move session persistent data to $XDG_STATE_HOME Change 'directory',
  'backupdir', 'undodir', 'viewdir' and 'shadafile' default location to
  $XDG_STATE_HOME/nvim.
- Move logs to $XDG_STATE_HOME, too.
- Add stdpath('log') support.

Fixes: #14805
This commit is contained in:
Ivan
2021-09-06 20:35:34 +03:00
committed by Justin M. Keyes
parent a1b663cce8
commit 78a1e6bc00
15 changed files with 303 additions and 224 deletions

View File

@@ -491,17 +491,17 @@ void set_init_1(bool clean_arg)
#endif
false);
char *backupdir = stdpaths_user_data_subpath("backup", 2, true);
char *backupdir = stdpaths_user_state_subpath("backup", 2, true);
const size_t backupdir_len = strlen(backupdir);
backupdir = xrealloc(backupdir, backupdir_len + 3);
memmove(backupdir + 2, backupdir, backupdir_len + 1);
memmove(backupdir, ".,", 2);
set_string_default("backupdir", backupdir, true);
set_string_default("viewdir", stdpaths_user_data_subpath("view", 2, true),
set_string_default("viewdir", stdpaths_user_state_subpath("view", 2, true),
true);
set_string_default("directory", stdpaths_user_data_subpath("swap", 2, true),
set_string_default("directory", stdpaths_user_state_subpath("swap", 2, true),
true);
set_string_default("undodir", stdpaths_user_data_subpath("undo", 2, true),
set_string_default("undodir", stdpaths_user_state_subpath("undo", 2, true),
true);
// Set default for &runtimepath. All necessary expansions are performed in
// this function.