summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xbot.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/xbot.c b/src/xbot.c
index 2bc7def..1eb6065 100644
--- a/src/xbot.c
+++ b/src/xbot.c
@@ -10,7 +10,7 @@
#include <strophe.h>
-#define DEFAULT_PROFILE_PATH "~/.config/xbot/profile.ini"
+#define DEFAULT_PROFILE_PATH_APPENDIX "/.config/xbot/profile.ini"
struct xmpp_job_t
@@ -84,8 +84,10 @@ void parse_cli_args(int argc, char **argv, struct xmpp_job_t *job, char **cfg_pa
}
if(*cfg_path == NULL)
{
- *cfg_path = malloc((strlen(DEFAULT_PROFILE_PATH) + 1)*sizeof(char));
- strcpy(*cfg_path, DEFAULT_PROFILE_PATH);
+ char *homedir = getenv("HOME");
+ *cfg_path = malloc((strlen(homedir) + strlen(DEFAULT_PROFILE_PATH_APPENDIX) + 1)*sizeof(char));
+ strcpy(*cfg_path, homedir);
+ strcat(*cfg_path, DEFAULT_PROFILE_PATH_APPENDIX);
}
printf("message = '%s'\ntarget_jid = '%s'\nprofile_path = '%s'\n", job->message, job->recipient_jid, *cfg_path);
}