Skip to content

require_all_files_in_config_directory uses a hardcoded absolute path with no existence check — hard error on new machines #162

@ooloth

Description

@ooloth

Current state

lua/config/util/init.lua constructs the config directory path by concatenating a hardcoded string: vim.env.HOME .. '/Repos/ooloth/config.nvim/lua/config/'. If this directory does not exist — on a new machine before the repo is cloned, with a different clone location, or if NVIM_APPNAME changes the expected path — vim.fn.readdir raises an unhandled Lua error at startup with no context about which path was expected or why it was missing. All lang plugins fail to load silently after the error.

Ideal state

  • require_all_files_in_config_directory checks that the resolved directory path exists before calling vim.fn.readdir
  • If the directory is absent, vim.notify emits an error-level message containing the full expected path so the user can diagnose the missing directory
  • Neovim continues to start (without lang plugins loading) rather than aborting with a hard Lua error

Starting points

  • lua/config/util/init.lua lines 37–45 — the hardcoded path construction and vim.fn.readdir call

QA plan

  1. Run HOME=/tmp nvim --headless -c "qall" to simulate a missing config directory
  2. Expect a vim.notify error message naming the expected path (e.g. /tmp/Repos/ooloth/config.nvim/lua/config/), not a raw Lua stack trace
  3. Expect Neovim to exit cleanly (exit 0) rather than aborting with a hard error
  4. Run nvim --headless -c "qall" with the real HOME — expect normal startup with no error messages

Done when

A missing config directory at the hardcoded path produces a vim.notify error with the full expected path, and Neovim continues to start rather than aborting.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions