mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-30 03:23:27 +01:00
Merge pull request #37 from FullName/ServListOnGivenFilename
If the user gave a filename for the datafile, don't imply that they want to ignore the serverlist file.
This commit is contained in:
commit
43f7847633
21
src/main.c
21
src/main.c
@ -389,21 +389,29 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DATA_FILE == NULL ) {
|
|
||||||
config_err = create_user_config_dir(user_config_dir);
|
config_err = create_user_config_dir(user_config_dir);
|
||||||
|
if (DATA_FILE == NULL ) {
|
||||||
if (config_err) {
|
if (config_err) {
|
||||||
DATA_FILE = strdup("data");
|
DATA_FILE = strdup("data");
|
||||||
SRVLIST_FILE = strdup(PACKAGE_DATADIR "/DHTservers");
|
|
||||||
} else {
|
} else {
|
||||||
DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1);
|
DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1);
|
||||||
SRVLIST_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("DHTservers") + 1);
|
if (DATA_FILE != NULL) {
|
||||||
|
|
||||||
if (DATA_FILE != NULL && SRVLIST_FILE != NULL) {
|
|
||||||
strcpy(DATA_FILE, user_config_dir);
|
strcpy(DATA_FILE, user_config_dir);
|
||||||
strcat(DATA_FILE, CONFIGDIR);
|
strcat(DATA_FILE, CONFIGDIR);
|
||||||
strcat(DATA_FILE, "data");
|
strcat(DATA_FILE, "data");
|
||||||
|
} else {
|
||||||
|
endwin();
|
||||||
|
fprintf(stderr, "malloc() failed. Aborting...\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config_err) {
|
||||||
|
SRVLIST_FILE = strdup(PACKAGE_DATADIR "/DHTservers");
|
||||||
|
} else {
|
||||||
|
SRVLIST_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("DHTservers") + 1);
|
||||||
|
if (SRVLIST_FILE != NULL) {
|
||||||
strcpy(SRVLIST_FILE, user_config_dir);
|
strcpy(SRVLIST_FILE, user_config_dir);
|
||||||
strcat(SRVLIST_FILE, CONFIGDIR);
|
strcat(SRVLIST_FILE, CONFIGDIR);
|
||||||
strcat(SRVLIST_FILE, "DHTservers");
|
strcat(SRVLIST_FILE, "DHTservers");
|
||||||
@ -413,7 +421,6 @@ int main(int argc, char *argv[])
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
free(user_config_dir);
|
free(user_config_dir);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user