mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 22:13:02 +01:00
Added mac support to the standardized data file, cleaned up a bit
This commit is contained in:
parent
1455716109
commit
8f244f2b6d
16
main.c
16
main.c
@ -74,10 +74,10 @@ static Messenger *init_tox()
|
|||||||
m_callback_action(m, on_action, NULL);
|
m_callback_action(m, on_action, NULL);
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
setname(m, (uint8_t *) "Cool guy", sizeof("Cool guy"));
|
setname(m, (uint8_t *) "Cool guy", sizeof("Cool guy"));
|
||||||
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
#elif win32
|
||||||
setname(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux"));
|
setname(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux"));
|
||||||
#else
|
#else
|
||||||
setname(m, (uint8_t *) "Hipster", sizeof("Hipster"));
|
setname(m, (uint8_t *) "Hipster", sizeof("Hipster")); //This implies users of other Unixes are hipsters
|
||||||
#endif
|
#endif
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
@ -92,8 +92,10 @@ int init_connection(void)
|
|||||||
if (DHT_isconnected())
|
if (DHT_isconnected())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
#if win32
|
||||||
FILE *fp = fopen("%appdata%/.tox/DHTservers", "r");
|
FILE *fp = fopen("%appdata%/.tox/DHTservers", "r");
|
||||||
|
#elif MAC_OSX
|
||||||
|
FILE *fp = fopen("~/Library/Application Support/.tox/DHTservers", "r");
|
||||||
#else
|
#else
|
||||||
FILE *fp = fopen("~/.tox/DHTservers", "r");
|
FILE *fp = fopen("~/.tox/DHTservers", "r");
|
||||||
#endif
|
#endif
|
||||||
@ -291,26 +293,22 @@ int main(int argc, char *argv[])
|
|||||||
if (config_err) {
|
if (config_err) {
|
||||||
#if WIN32
|
#if WIN32
|
||||||
DATA_FILE = strdup("%appdata/.tox/data");
|
DATA_FILE = strdup("%appdata/.tox/data");
|
||||||
#else
|
#elif MAC_OSX
|
||||||
#if MAC_OSX
|
|
||||||
DATA_FILE = strdup("~Library/Application Support/data");
|
DATA_FILE = strdup("~Library/Application Support/data");
|
||||||
#else
|
#else
|
||||||
DATA_FILE = strdup("~/.tox/data");
|
DATA_FILE = strdup("~/.tox/data");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
} 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);
|
||||||
strcpy(DATA_FILE, user_config_dir);
|
strcpy(DATA_FILE, user_config_dir);
|
||||||
strcat(DATA_FILE, CONFIGDIR);
|
strcat(DATA_FILE, CONFIGDIR);
|
||||||
#if WIN32
|
#if WIN32
|
||||||
DATA_FILE = strdup("%appdata/.tox/data");
|
DATA_FILE = strdup("%appdata/.tox/data");
|
||||||
#else
|
#elif MAC_OSX
|
||||||
#if MAC_OSX
|
|
||||||
DATA_FILE = strdup("~Library/Application Support/data");
|
DATA_FILE = strdup("~Library/Application Support/data");
|
||||||
#else
|
#else
|
||||||
DATA_FILE = strdup("~/.tox/data");
|
DATA_FILE = strdup("~/.tox/data");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user