How to use define-nyxt-user-system-and-load with checking subdirectory

I have some config files under a local subdirectory and I want to use define-nyxt-user-system-and-laod to define a enter point.

The subdirectory doesn’t exist on some machines, so I have to check them.

The question has two parts.

  1. How can I get current config dir similar to user-emacs-directory.
  2. How to use define-nyxt-user-system-and-load with a path related to above one. asdf:component-pathname in configuration.lisp seems use an absolute one.

By the way, (files:expand *config-file*) return the realpath of $HOME/.config/nyxt/config.lisp which is a symbol link.

All right, after I read nfiles and nyxt-files carefully, I found the fact that you use resolvers to try to expand the path under many different path.

Therefore, I can get the config path by using (files:resolve (files:profile *config-file*) (make-instance 'config-directory-file :base-path #p"local")) and set :config-directory to this. An example can be found here

However, this action is really counterintuitive. Furthermore, it will raise some issues if there are name conflictions.