Bug description
On Windows, I have my HOME environment variable set to "HOME=D:\". When reloading a CMake project session via Lazyvim, cmake-tools attempted to mkdir a malformed path to store/access session data.
I believe the culprit to be cmake-tools.nvim/lua/cmake-tools/session.lua:8:
win = vim.fn.expand("~") .. "/AppData/Local/cmake_tools_nvim/",
Steps to reproduce
Minimal configuration
Set Environment variable HOME=D:\
A session exists in a CMake project directory.
1. Attempt to load a CMake session, such that `init_cache` is called.
Expected behavior
- I would expect
cmake_tools to use the nvim-data directory, which could be accesed via vim.fn.stdpath("data") .. "/cmake_tools_nvim" instead of attempting to create another folder in my User area.
- Failing that, instead of doing
vim.fn.expand("~") on Windows, the Users Local AppData directory can be accessed via the environment variable %LOCALAPPDATA%.
- Failing either of those, perhaps the cmake_tools_nvim directory could be specified by users in the config.
Screenshots
The error stacktrace:
Error 13:08:31 msg_show.lua_error Error executing vim.schedule lua callback: DirChanged Autocommands for "*": Vim(append):Error executing lua callback: ...a/Local/nvim-data/lazy/plenary.nvim/lua/plenary/path.lua:505: We couldn't mkdir: D:\/AppData/Local/cmake_tools_nvim/
stack traceback:
[C]: in function 'error'
...a/Local/nvim-data/lazy/plenary.nvim/lua/plenary/path.lua:505: in function 'mkdir'
...vim-data/lazy/cmake-tools.nvim/lua/cmake-tools/utils.lua:48: in function 'mkdir'
...m-data/lazy/cmake-tools.nvim/lua/cmake-tools/session.lua:39: in function 'init_cache'
...m-data/lazy/cmake-tools.nvim/lua/cmake-tools/session.lua:45: in function 'init_session'
...m-data/lazy/cmake-tools.nvim/lua/cmake-tools/session.lua:95: in function 'save'
...nvim-data/lazy/cmake-tools.nvim/lua/cmake-tools/init.lua:1764: in function <...nvim-data/lazy/cmake-tools.nvim/lua/cmake-tools/init.lua:1757>
[C]: in function 'chdir'
...nvim-data/lazy/persistence.nvim/lua/persistence/init.lua:131: in function 'on_choice'
.../nvim-data/lazy/snacks.nvim/lua/snacks/picker/select.lua:59: in function <.../nvim-data/lazy/snacks.nvim/lua/snacks/picker/select.lua:58>
stack traceback:
[C]: in function 'chdir'
...nvim-data/lazy/persistence.nvim/lua/persistence/init.lua:131: in function 'on_choice'
.../nvim-data/lazy/snacks.nvim/lua/snacks/picker/select.lua:59: in function <.../nvim-data/lazy/snacks.nvim/lua/snacks/picker/select.lua:58>
Environment
- OS: Windows 11
- Desktop environment: N/A
- Plugins commit hash: 38f320f
Contents in the *cmake-tools* buffer
Sorry, not sure where this buffer is? I can update with that info if necessary.
Bug description
On Windows, I have my HOME environment variable set to "HOME=D:\". When reloading a CMake project session via Lazyvim, cmake-tools attempted to mkdir a malformed path to store/access session data.
I believe the culprit to be
cmake-tools.nvim/lua/cmake-tools/session.lua:8:Steps to reproduce
Minimal configuration
Set Environment variable HOME=D:\ A session exists in a CMake project directory.Expected behavior
cmake_toolsto use thenvim-datadirectory, which could be accesed viavim.fn.stdpath("data") .. "/cmake_tools_nvim"instead of attempting to create another folder in my User area.vim.fn.expand("~")on Windows, the Users Local AppData directory can be accessed via the environment variable %LOCALAPPDATA%.Screenshots
The error stacktrace:
Environment
Contents in the *cmake-tools* buffer
Sorry, not sure where this buffer is? I can update with that info if necessary.