load user config before project config

This commit is contained in:
Timerix 2025-11-12 14:31:22 +05:00
parent fca94ffe4c
commit 5cc2e1c2ad
2 changed files with 15 additions and 10 deletions

View File

@ -1,3 +1,6 @@
## 2.3.1
+ user config loads before project config
## 2.3.0 ## 2.3.0
+ **CONFIG:** Added new file `./project.config.user.default`. + **CONFIG:** Added new file `./project.config.user.default`.
+ **CONFIG:** Changed `cbuild/default_tasks` to `@cbuild/default_tasks`. + **CONFIG:** Changed `cbuild/default_tasks` to `@cbuild/default_tasks`.

View File

@ -10,8 +10,6 @@ function load_config {
#true or false #true or false
local quiet=$3 local quiet=$3
myprint "${BLUE}loading ${WHITE}'$proj_conf_file'"
if [ -z "$proj_conf_file" ]; then if [ -z "$proj_conf_file" ]; then
error "config path is null" error "config path is null"
fi fi
@ -19,6 +17,18 @@ function load_config {
error "${YELLOW}$proj_conf_file doesn't exist" error "${YELLOW}$proj_conf_file doesn't exist"
fi fi
# load project user config
local proj_conf_user_file="$proj_conf_file.user"
file_copy_default_if_not_present "$proj_conf_user_file" "$proj_conf_user_file.default"
myprint "${BLUE}loading ${WHITE}'$proj_conf_user_file'"
# throw error on undefined variable usage
set -u
include "$proj_conf_user_file"
# don't throw error on undefined variable usage
set +u
myprint "${BLUE}loading ${WHITE}'$proj_conf_file'"
OS=$(detect_os) OS=$(detect_os)
ARCH=$(detect_arch) ARCH=$(detect_arch)
myprint_quiet $quiet "${GREEN}detected OS: $OS" myprint_quiet $quiet "${GREEN}detected OS: $OS"
@ -48,23 +58,15 @@ function load_config {
myprint "${YELLOW}Install it to get latest bugfixes." myprint "${YELLOW}Install it to get latest bugfixes."
fi fi
# throw error on undefined variable usage
set -u set -u
include "$proj_conf_file" include "$proj_conf_file"
# load project user config
local proj_conf_user_file="$proj_conf_file.user"
file_copy_default_if_not_present "$proj_conf_user_file" "$proj_conf_user_file.default"
myprint "${BLUE}loading ${WHITE}'$proj_conf_user_file'"
include "$proj_conf_user_file"
mkdir -p "$OUTDIR" mkdir -p "$OUTDIR"
mkdir -p "$OBJDIR/objects" mkdir -p "$OBJDIR/objects"
mkdir -p "$OBJDIR/static_libs" mkdir -p "$OBJDIR/static_libs"
mkdir -p "$OBJDIR/dynamic_libs" mkdir -p "$OBJDIR/dynamic_libs"
mkdir -p "$OBJDIR/profile" mkdir -p "$OBJDIR/profile"
# dont thorw error on undefined variable
set +u set +u
myprint_quiet $quiet "${GREEN}config loading completed" myprint_quiet $quiet "${GREEN}config loading completed"