From 917af9b00771e61cc4d409c5b93430c45aa34a67 Mon Sep 17 00:00:00 2001 From: cage Date: Sun, 24 Mar 2024 14:27:57 +0100 Subject: [PATCH] - intstructed the program to generate a default database file name when no valid user and server name has been found in the configuration file. --- src/constants.lisp | 6 +++++- src/main.lisp | 4 ++-- src/package.lisp | 2 ++ src/software-configuration.lisp | 6 +++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/constants.lisp b/src/constants.lisp index 4111878..f9b8bdb 100644 --- a/src/constants.lisp +++ b/src/constants.lisp @@ -123,7 +123,11 @@ General Public License for more details." (define-constant +mime-type-text+ "text/plain" :test #'string=) (define-constant +db-file-extension+ "sqlite3" :test #'string= - :documentation "the extension filename of the databases") + :documentation "the extension filename of the databases") + +(define-constant +default-database-username+ "default" :test #'string=) + +(define-constant +default-database-server-name+ "default" :test #'string=) (define-constant +json-true+ "true" :test #'string=) diff --git a/src/main.lisp b/src/main.lisp index 88b4724..a8586a1 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -282,5 +282,5 @@ etc.) happened" (print c)))) (tui-init) - (let ((first-time-starting (not (db-utils:db-file-exists-p)))) - (run first-time-starting)))))) + (let ((first-time-starting (not (db-utils:db-file-exists-p)))) + (run first-time-starting)))))) diff --git a/src/package.lisp b/src/package.lisp index ecd6ea5..0a20508 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -56,6 +56,8 @@ :+mime-type-html+ :+mime-type-text+ :+db-file-extension+ + :+default-database-username+ + :+default-database-server-name+ :+fps+ :+command-window-height+ :+starting-init-file+ diff --git a/src/software-configuration.lisp b/src/software-configuration.lisp index 42882c6..9b41afb 100644 --- a/src/software-configuration.lisp +++ b/src/software-configuration.lisp @@ -1136,7 +1136,11 @@ (cond ((not (or username server-name)) - (set-currents (first (config-username)) (first (config-server-name)))) + (if (and (config-username) + (config-server-name)) + (set-currents (first (config-username)) (first (config-server-name))) + (set-currents +default-database-username+ + +default-database-server-name+))) ((and (text-utils:string-not-empty-p username) (text-utils:string-not-empty-p server-name)) (let* ((position-all-usernames (loop for pos from 0