diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2015-10-27 00:23:48 +0000 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-03-03 23:26:11 -0500 |
commit | 4bfac00aa389487c4f11d34e7a3e96e4a1116800 (patch) | |
tree | 2413d2e86c54de7ffb449232a3a9157ce83d66f8 /src/nvim/os/stdpaths.c | |
parent | 32238018e4d7fa617d291c916448f041da8aea35 (diff) | |
download | rneovim-4bfac00aa389487c4f11d34e7a3e96e4a1116800.tar.gz rneovim-4bfac00aa389487c4f11d34e7a3e96e4a1116800.tar.bz2 rneovim-4bfac00aa389487c4f11d34e7a3e96e4a1116800.zip |
Windows: XDG: Update default paths. #4403
The previous defaults were including the nvim suffix, causing it to
apear twice in the final paths.
kXDGDataHome and kXDGConfigHome are now set as %LOCALAPPDATA%,
kXDGCacheHome is set as $TEMP.
In Windows there is no distinction between configuration and data
storage, but we don't want to place all files under the same path.
get_xdg_home() now appends a different path suffix for kXDGDataHome.
- Configuration files are saved under %LOCALAPPDATA%\nvim
- Data files are saved under %LOCALAPPDATA%\nvim-data
Diffstat (limited to 'src/nvim/os/stdpaths.c')
-rw-r--r-- | src/nvim/os/stdpaths.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c index c9631a434c..8a8f43cb8a 100644 --- a/src/nvim/os/stdpaths.c +++ b/src/nvim/os/stdpaths.c @@ -22,9 +22,9 @@ static const char *xdg_env_vars[] = { static const char *const xdg_defaults[] = { #ifdef WIN32 // Windows - [kXDGConfigHome] = "$LOCALAPPDATA\\nvim\\config", - [kXDGDataHome] = "$LOCALAPPDATA\\nvim\\data", - [kXDGCacheHome] = "$LOCALAPPDATA\\nvim\\cache", + [kXDGConfigHome] = "$LOCALAPPDATA", + [kXDGDataHome] = "$LOCALAPPDATA", + [kXDGCacheHome] = "$TEMP", [kXDGRuntimeDir] = NULL, [kXDGConfigDirs] = NULL, [kXDGDataDirs] = NULL, @@ -66,12 +66,20 @@ char *stdpaths_get_xdg_var(const XDGVarType idx) /// @param[in] idx XDG directory to use. /// /// @return [allocated] `{xdg_directory}/nvim` +/// +/// In WIN32 get_xdg_home(kXDGDataHome) returns `{xdg_directory}/nvim-data` to +/// avoid storing configuration and data files in the same path. static char *get_xdg_home(const XDGVarType idx) FUNC_ATTR_WARN_UNUSED_RESULT { char *dir = stdpaths_get_xdg_var(idx); if (dir) { +#if defined(WIN32) + dir = concat_fnames_realloc(dir, (idx == kXDGDataHome ? "nvim-data" : "nvim"), + true); +#else dir = concat_fnames_realloc(dir, "nvim", true); +#endif } return dir; } |