mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 22:53:03 +01:00
Fixed toxic not running
This commit is contained in:
parent
4fe94ca403
commit
3c77156d6d
39
main.c
39
main.c
@ -27,6 +27,7 @@
|
||||
|
||||
/* Export for use in Callbacks */
|
||||
char *DATA_FILE = NULL;
|
||||
char dir[31];
|
||||
|
||||
void on_window_resize(int sig)
|
||||
{
|
||||
@ -35,6 +36,17 @@ void on_window_resize(int sig)
|
||||
clear();
|
||||
}
|
||||
|
||||
void setdir()
|
||||
{
|
||||
#ifdef WIN32
|
||||
strcpy(dir, "%appdata%/.tox/");
|
||||
#elif defined(MAC_OSX)
|
||||
strcpy(dir, "~/Library/Application Support/.tox/");
|
||||
#elif defined(linux)
|
||||
strcpy(dir, "~/.tox/");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void init_term()
|
||||
{
|
||||
/* Setup terminal */
|
||||
@ -74,9 +86,9 @@ static Messenger *init_tox()
|
||||
m_callback_action(m, on_action, NULL);
|
||||
#ifdef __linux__
|
||||
setname(m, (uint8_t *) "Cool guy", sizeof("Cool guy"));
|
||||
#elif win32
|
||||
#elif defined(WIN32)
|
||||
setname(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux"));
|
||||
#elif MAC_OSX
|
||||
#elif defined(MAC_OSX)
|
||||
setname(m, (uint8_t *) "Hipster", sizeof("Hipster")); //This used to users of other Unixes are hipsters
|
||||
#else
|
||||
setname(m, (uint8_t *) "Registered Minix user #4", sizeof("Registered Minix user #4"));
|
||||
@ -94,7 +106,7 @@ int init_connection(void)
|
||||
if (DHT_isconnected())
|
||||
return 0;
|
||||
|
||||
#if win32
|
||||
#if WIN32
|
||||
FILE *fp = fopen("%appdata%/.tox/DHTservers", "r");
|
||||
#elif MAC_OSX
|
||||
FILE *fp = fopen("~/Library/Application Support/.tox/DHTservers", "r");
|
||||
@ -267,6 +279,7 @@ static void load_data(Messenger *m, char *path)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setdir();
|
||||
char *user_config_dir = get_user_config_dir();
|
||||
int config_err = 0;
|
||||
|
||||
@ -293,24 +306,16 @@ int main(int argc, char *argv[])
|
||||
config_err = create_user_config_dir(user_config_dir);
|
||||
|
||||
if (config_err) {
|
||||
#if WIN32
|
||||
DATA_FILE = strdup("%appdata/.tox/data");
|
||||
#elif MAC_OSX
|
||||
DATA_FILE = strdup("~Library/Application Support/data");
|
||||
#else
|
||||
DATA_FILE = strdup("~/.tox/data");
|
||||
#endif
|
||||
strcat(DATA_FILE, dir);
|
||||
DATA_FILE = strdup("data");
|
||||
|
||||
|
||||
} else {
|
||||
DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1);
|
||||
strcpy(DATA_FILE, user_config_dir);
|
||||
strcat(DATA_FILE, CONFIGDIR);
|
||||
#if WIN32
|
||||
DATA_FILE = strdup("%appdata/.tox/data");
|
||||
#elif MAC_OSX
|
||||
DATA_FILE = strdup("~Library/Application Support/data");
|
||||
#else
|
||||
DATA_FILE = strdup("~/.tox/data");
|
||||
#endif
|
||||
strcat(DATA_FILE, dir);
|
||||
DATA_FILE = strdup("data");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user