Refactor logging path initialization: use custom appdata path for log files

This commit is contained in:
Riley 2025-05-13 19:52:46 -05:00
parent 861c05bc25
commit ec75e0723e

View file

@ -14,8 +14,10 @@
int main(void) {
char *log_folder_path = custom_appdata_path("Logs");
char *log_path = malloc(256);
cwk_path_join(appdata_home_path(), "error.log", log_path, 256);
cwk_path_join(log_folder_path, "error.log", log_path, 256);
FILE *fp_e = fopen(log_path, "a+");
if (fp_e) {
log_add_fp(fp_e, LOG_ERROR);
@ -25,7 +27,7 @@ int main(void) {
free(log_path);
log_path = malloc(256);
cwk_path_join(appdata_home_path(), "debug.log", log_path, 256);
cwk_path_join(log_folder_path, "debug.log", log_path, 256);
FILE *fp_d = fopen(log_path, "a+");
if (fp_d) {
log_add_fp(fp_d, LOG_DEBUG);