summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Qureshi <stqism@risingstormgames.com>2013-08-18 03:41:30 -0700
committerSean Qureshi <stqism@risingstormgames.com>2013-08-18 03:41:30 -0700
commitbdfd890aa835d6601003541bce722c607e90cc6b (patch)
tree0ec3caa5196a13a70e547fd33129c0170744a55d
parentc3d90c67640b72a57007d0f6261a5a30ed079be2 (diff)
Added mac support to the standardized data file, cleaned up a bit
-rw-r--r--other/CMakeLists.txt9
-rw-r--r--testing/toxic/main.c16
2 files changed, 14 insertions, 11 deletions
diff --git a/other/CMakeLists.txt b/other/CMakeLists.txt
index 068f83db..22867773 100644
--- a/other/CMakeLists.txt
+++ b/other/CMakeLists.txt
@@ -9,8 +9,13 @@ if(WIN32)
9 file(INSTALL DHTservers DESTINATION %appdata%/.tox) 9 file(INSTALL DHTservers DESTINATION %appdata%/.tox)
10else() 10else()
11 set(HOME "$ENV{HOME}") 11 set(HOME "$ENV{HOME}")
12 file(MAKE_DIRECTORY ${HOME}/.tox) 12 if(APPLE)
13 file(INSTALL DHTservers DESTINATION ${HOME}/.tox) 13 file(MAKE_DIRECTORY ${HOME}Library/Application Support/.tox)
14 file(INSTALL DHTservers DESTINATION ${HOME}Library/Application Support/.tox)
15 else()
16 file(MAKE_DIRECTORY ${HOME}/.tox)
17 file(INSTALL DHTservers DESTINATION ${HOME}/.tox)
18 endif()
14endif() 19endif()
15 20
16if(LINUX) 21if(LINUX)
diff --git a/testing/toxic/main.c b/testing/toxic/main.c
index 52e810d6..2ce2dbf5 100644
--- a/testing/toxic/main.c
+++ b/testing/toxic/main.c
@@ -74,10 +74,10 @@ static Messenger *init_tox()
74 m_callback_action(m, on_action, NULL); 74 m_callback_action(m, on_action, NULL);
75#ifdef __linux__ 75#ifdef __linux__
76 setname(m, (uint8_t *) "Cool guy", sizeof("Cool guy")); 76 setname(m, (uint8_t *) "Cool guy", sizeof("Cool guy"));
77#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) 77#elif win32
78 setname(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux")); 78 setname(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux"));
79#else 79#else
80 setname(m, (uint8_t *) "Hipster", sizeof("Hipster")); 80 setname(m, (uint8_t *) "Hipster", sizeof("Hipster")); //This implies users of other Unixes are hipsters
81#endif 81#endif
82 return m; 82 return m;
83} 83}
@@ -92,8 +92,10 @@ int init_connection(void)
92 if (DHT_isconnected()) 92 if (DHT_isconnected())
93 return 0; 93 return 0;
94 94
95#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) 95#if win32
96 FILE *fp = fopen("%appdata%/.tox/DHTservers", "r"); 96 FILE *fp = fopen("%appdata%/.tox/DHTservers", "r");
97#elif MAC_OSX
98 FILE *fp = fopen("~/Library/Application Support/.tox/DHTservers", "r");
97#else 99#else
98 FILE *fp = fopen("~/.tox/DHTservers", "r"); 100 FILE *fp = fopen("~/.tox/DHTservers", "r");
99#endif 101#endif
@@ -291,26 +293,22 @@ int main(int argc, char *argv[])
291 if (config_err) { 293 if (config_err) {
292 #if WIN32 294 #if WIN32
293 DATA_FILE = strdup("%appdata/.tox/data"); 295 DATA_FILE = strdup("%appdata/.tox/data");
294 #else 296 #elif MAC_OSX
295 #if MAC_OSX
296 DATA_FILE = strdup("~Library/Application Support/data"); 297 DATA_FILE = strdup("~Library/Application Support/data");
297 #else 298 #else
298 DATA_FILE = strdup("~/.tox/data"); 299 DATA_FILE = strdup("~/.tox/data");
299 #endif 300 #endif
300 #endif
301 } else { 301 } else {
302 DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1); 302 DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1);
303 strcpy(DATA_FILE, user_config_dir); 303 strcpy(DATA_FILE, user_config_dir);
304 strcat(DATA_FILE, CONFIGDIR); 304 strcat(DATA_FILE, CONFIGDIR);
305 #if WIN32 305 #if WIN32
306 DATA_FILE = strdup("%appdata/.tox/data"); 306 DATA_FILE = strdup("%appdata/.tox/data");
307 #else 307 #elif MAC_OSX
308 #if MAC_OSX
309 DATA_FILE = strdup("~Library/Application Support/data"); 308 DATA_FILE = strdup("~Library/Application Support/data");
310 #else 309 #else
311 DATA_FILE = strdup("~/.tox/data"); 310 DATA_FILE = strdup("~/.tox/data");
312 #endif 311 #endif
313 #endif
314 } 312 }
315 } 313 }
316 314