1
0
Fork 0

- ensured, when program starts, that the init file in the user's home is loaded (if such init file exists).

This commit is contained in:
cage 2021-10-07 21:52:36 +02:00
parent 9005e9ec55
commit c924e8f636
2 changed files with 23 additions and 16 deletions

View File

@ -122,13 +122,15 @@ etc.) happened"
(shared-init)
(db-utils:with-ready-database (:connect nil)
(complete:initialize-complete-username-cache)
(handler-case
(or (ignore-errors (modules:load-sys-module +starting-init-file+))
(modules:load-module +starting-init-file+))
(error (e)
(let ((system-config-file-found-p (modules:load-sys-module +starting-init-file+
:not-found-signal-error nil)))
(multiple-value-bind (home-config-file-found-p error-message)
(modules:load-module +starting-init-file+ :not-found-signal-error nil)
(when (not (or system-config-file-found-p
home-config-file-found-p))
(croatoan:end-screen)
(format *error-output* "~a~%" e)
(os-utils:exit-program 1)))
(format *error-output* "~a~%" error-message)
(os-utils:exit-program 1))))
;; init main window for first...
(main-window:init)
(keybindings-window:init)

View File

@ -17,11 +17,13 @@
(in-package :modules)
(defun load-sys-module (path)
(let ((file (get-sys-config-file path)))
(defun load-sys-module (path &key (not-found-signal-error t))
(when-let ((file (if not-found-signal-error
(get-sys-config-file path)
(ignore-errors (get-sys-config-file path)))))
(load file :verbose nil :print nil)))
(defun load-module (path)
(defun load-module (path &key (not-found-signal-error t))
(flet ((%load (file)
(load file :verbose nil :print nil)))
(let ((config-file (conditions:with-default-on-error (nil)
@ -34,10 +36,13 @@
(data-file
(%load data-file))
(t
(error (format nil
(_ "Unrecoverable error: file ~a not found in any of the directory ~a ~a ~a ~a")
path
+sys-data-dir+
+sys-conf-dir+
(home-datadir)
(home-confdir))))))))
(let ((error-message (format nil
(_ "Unrecoverable error: file ~a not found in any of the directory ~a ~a ~a ~a")
path
+sys-data-dir+
+sys-conf-dir+
(home-datadir)
(home-confdir))))
(if not-found-signal-error
(error error-message)
(values nil error-message))))))))