diff --git a/include/flags.h b/include/flags.h index 380bfcb..ad8ae65 100644 --- a/include/flags.h +++ b/include/flags.h @@ -51,7 +51,7 @@ 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/{USER}/.config/WHY2" +#define WHY2_CONFIG_DIR "{HOME}/.config/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) diff --git a/src/chat/config.c b/src/chat/config.c index 39977d0..5d1d78a 100644 --- a/src/chat/config.c +++ b/src/chat/config.c @@ -46,11 +46,11 @@ void init_config(char *filename) char *buffer = why2_malloc(strlen(WHY2_CONFIG_DIR) + strlen(filename) + 2); sprintf(buffer, "%s/%s", WHY2_CONFIG_DIR, filename); - char *path = why2_replace(buffer, "{USER}", getenv("USER")); + char *path = why2_replace(buffer, "{HOME}", getenv("HOME")); if (access(path, R_OK) != 0) //CONFIG DOESN'T EXIST { - char *config_dir = why2_replace(WHY2_CONFIG_DIR, "{USER}", getenv("USER")); + char *config_dir = why2_replace(WHY2_CONFIG_DIR, "{HOME}", getenv("HOME")); //CREATE CONFIG DIRECTORY mkdir(config_dir, 0700); @@ -85,11 +85,11 @@ char *config(char *key, enum CONFIG_TYPES type) switch (type) //GET path { case CLIENT: - path = why2_replace(WHY2_CONFIG_DIR "/" WHY2_CHAT_CONFIG_CLIENT, "{USER}", getenv("USER")); + path = why2_replace(WHY2_CONFIG_DIR "/" WHY2_CHAT_CONFIG_CLIENT, "{HOME}", getenv("HOME")); break; case SERVER: - path = why2_replace(WHY2_CONFIG_DIR "/" WHY2_CHAT_CONFIG_SERVER, "{USER}", getenv("USER")); + path = why2_replace(WHY2_CONFIG_DIR "/" WHY2_CHAT_CONFIG_SERVER, "{HOME}", getenv("HOME")); break; default: @@ -149,5 +149,5 @@ char *why2_chat_client_config(char *key) char *why2_get_server_users_path(void) { - return why2_replace(WHY2_CONFIG_DIR "/" WHY2_CHAT_CONFIG_SERVER_USERS, "{USER}", getenv("USER")); + return why2_replace(WHY2_CONFIG_DIR "/" WHY2_CHAT_CONFIG_SERVER_USERS, "{HOME}", getenv("HOME")); } \ No newline at end of file diff --git a/src/chat/crypto.c b/src/chat/crypto.c index 127378e..3ca452c 100644 --- a/src/chat/crypto.c +++ b/src/chat/crypto.c @@ -110,7 +110,7 @@ void why2_chat_init_keys(void) FILE *private; //GET PATH TO KEY DIR - char *path = why2_replace(WHY2_CHAT_KEY_LOCATION, "{USER}", getenv("USER")); + char *path = why2_replace(WHY2_CHAT_KEY_LOCATION, "{HOME}", getenv("HOME")); //ALLOCATE THE KEY PATHS char *public_path = why2_malloc(strlen(path) + strlen(WHY2_CHAT_PUB_KEY) + 3); diff --git a/src/core/lib/utils/misc.c b/src/core/lib/utils/misc.c index ba085a6..253e32e 100644 --- a/src/core/lib/utils/misc.c +++ b/src/core/lib/utils/misc.c @@ -56,7 +56,7 @@ int removeDirectory(char *path) void why2_directory(void) { struct stat st; - char *buffer = why2_replace(WHY2_CONFIG_DIR, "{USER}", getenv("USER")); + char *buffer = why2_replace(WHY2_CONFIG_DIR, "{HOME}", getenv("HOME")); //CREATE USER CONFIG FOLDER if (stat(buffer, &st) == -1) @@ -79,7 +79,7 @@ enum WHY2_EXIT_CODES why2_check_version(void) int not_found_buffer = 0; //GET VERSION FILE - char *version_file = why2_replace(WHY2_VERSIONS_NAME, "{USER}", getenv("USER")); + char *version_file = why2_replace(WHY2_VERSIONS_NAME, "{HOME}", getenv("HOME")); //CURL VARIABLES CURL *curl = curl_easy_init();