Compare commits

..

2 Commits

Author SHA1 Message Date
e537f385e4
creating .config dir if needed
stupid gitea
2025-01-09 16:19:03 +01:00
0a7e9ecee7
created WHY2_USER_CONFIG_DIR macro
stupid gitea runner making me do shit
2025-01-09 16:15:55 +01:00
2 changed files with 10 additions and 1 deletions
include
src/core/lib/utils

@ -51,7 +51,8 @@ enum WHY2_OUTPUT_FORMAT
#define WHY2_VERSION "v5.0" //WHY2_VERSION OF CURRENT BUILD > DO NOT TOUCH THIS <
#define WHY2_VERSIONS_URL "https://raw.githubusercontent.com/ENGO150/WHY2/release/versions.json" //URL FOR GETTING versions.json
#define WHY2_CONFIG_DIR "{HOME}/.config/WHY2"
#define WHY2_USER_CONFIG_DIR "{HOME}/.config"
#define WHY2_CONFIG_DIR WHY2_USER_CONFIG_DIR "/WHY2"
#define WHY2_VERSIONS_NAME WHY2_CONFIG_DIR "/.versions.json" //do I have to explain this?
#define WHY2_UPDATE_URL "https://github.com/ENGO150/WHY2.git" // REPOSITORY URL FOR UPDATES (YOU DON'T SAY)

@ -56,15 +56,23 @@ int removeDirectory(char *path)
void why2_directory(void)
{
struct stat st;
char *buffer_2 = why2_replace(WHY2_USER_CONFIG_DIR, "{HOME}", getenv("HOME"));
char *buffer = why2_replace(WHY2_CONFIG_DIR, "{HOME}", getenv("HOME"));
//CREATE USER CONFIG FOLDER
if (stat(buffer_2, &st) == -1)
{
mkdir(buffer_2, 0700);
}
//CREATE WHY2 CONFIG FOLDER
if (stat(buffer, &st) == -1)
{
mkdir(buffer, 0700);
}
//DEALLOCATION
why2_deallocate(buffer_2);
why2_deallocate(buffer);
}