diff options
-rw-r--r-- | testing/toxic/main.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/testing/toxic/main.c b/testing/toxic/main.c index ec33c72f..53639eb2 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c | |||
@@ -196,17 +196,8 @@ static void load_data(Messenger *m, char *path) | |||
196 | int main(int argc, char *argv[]) | 196 | int main(int argc, char *argv[]) |
197 | { | 197 | { |
198 | char *user_config_dir = get_user_config_dir(); | 198 | char *user_config_dir = get_user_config_dir(); |
199 | char *DATA_FILE; | 199 | char *DATA_FILE = NULL; |
200 | int config_err = create_user_config_dir(user_config_dir); | 200 | int config_err = 0; |
201 | if(config_err) { | ||
202 | DATA_FILE = "data"; | ||
203 | } else { | ||
204 | DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1); | ||
205 | strcpy(DATA_FILE, user_config_dir); | ||
206 | strcat(DATA_FILE, CONFIGDIR); | ||
207 | strcat(DATA_FILE, "data"); | ||
208 | } | ||
209 | free(user_config_dir); | ||
210 | 201 | ||
211 | /* This is broken */ | 202 | /* This is broken */ |
212 | int f_loadfromfile = 1; | 203 | int f_loadfromfile = 1; |
@@ -227,6 +218,19 @@ int main(int argc, char *argv[]) | |||
227 | } | 218 | } |
228 | } | 219 | } |
229 | 220 | ||
221 | if (DATA_FILE == NULL ) { | ||
222 | config_err = create_user_config_dir(user_config_dir); | ||
223 | if (config_err) { | ||
224 | DATA_FILE = strdup("data"); | ||
225 | } else { | ||
226 | DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1); | ||
227 | strcpy(DATA_FILE, user_config_dir); | ||
228 | strcat(DATA_FILE, CONFIGDIR); | ||
229 | strcat(DATA_FILE, "data"); | ||
230 | } | ||
231 | } | ||
232 | free(user_config_dir); | ||
233 | |||
230 | init_term(); | 234 | init_term(); |
231 | Messenger *m = init_tox(); | 235 | Messenger *m = init_tox(); |
232 | ToxWindow * prompt = init_windows(m); | 236 | ToxWindow * prompt = init_windows(m); |