1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 01:33:02 +01:00

drop broken windows support

This commit is contained in:
Jfreegman 2014-06-11 14:37:36 -04:00
parent 328e7f8d57
commit 12e33a1760
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
4 changed files with 5 additions and 67 deletions

View File

@ -30,14 +30,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#ifdef _WIN32
#include <shlobj.h>
#include <direct.h>
#else /* WIN32 */
#include <unistd.h>
#include <pwd.h>
#endif /* WIN32 */
#include "configdir.h"
@ -51,25 +45,6 @@
char *get_user_config_dir(void)
{
char *user_config_dir;
#ifdef _WIN32
#warning Please fix configdir for Win32
return NULL;
#if 0
char appdata[MAX_PATH];
BOOL ok;
ok = SHGetSpecialFolderPathA(NULL, appdata, CSIDL_PROFILE, TRUE);
if (!ok) {
return NULL;
}
user_config_dir = strdup(appdata);
return user_config_dir;
#endif
#else /* WIN32 */
#ifndef NSS_BUFLEN_PASSWD
#define NSS_BUFLEN_PASSWD 4096
@ -128,7 +103,6 @@ char *get_user_config_dir(void)
return user_config_dir;
#undef NSS_BUFLEN_PASSWD
#endif /* WIN32 */
}
/*
@ -136,26 +110,6 @@ char *get_user_config_dir(void)
*/
int create_user_config_dir(char *path)
{
#ifdef _WIN32
#warning Please fix configdir for Win32
return -1;
#if 0
char *fullpath = malloc(strlen(path) + strlen(CONFIGDIR) + 1);
strcpy(fullpath, path);
strcat(fullpath, CONFIGDIR);
mkdir_err = _mkdir(fullpath);
struct __stat64 buf;
if (mkdir_err && (errno != EEXIST || _wstat64(fullpath, &buf) || !S_ISDIR(buf.st_mode))) {
free(fullpath);
return -1;
}
free(fullpath);
#endif
#else
int mkdir_err;
mkdir_err = mkdir(path, 0700);
@ -178,5 +132,4 @@ int create_user_config_dir(char *path)
free(fullpath);
return 0;
#endif
}

View File

@ -20,11 +20,7 @@
*
*/
#ifdef _win32
#define CONFIGDIR "\\tox\\"
#else
#define CONFIGDIR "/tox/"
#endif
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)

View File

@ -40,18 +40,11 @@
#include <time.h>
#include <pthread.h>
#include <getopt.h>
#ifdef _WIN32
#include <direct.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <netdb.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#endif
#include <tox/tox.h>

View File

@ -240,16 +240,12 @@ void get_file_name(uint8_t *namebuf, uint8_t *pathname)
while (idx >= 0 && pathname[idx] == '/')
pathname[idx--] = '\0';
uint8_t *filename = strrchr(pathname, '/'); /* Try unix style paths */
uint8_t *filename = strrchr(pathname, '/');
if (filename != NULL) {
if (!strlen(++filename))
filename = pathname;
} else {
filename = strrchr(pathname, '\\'); /* Try windows style paths */
if (filename == NULL)
filename = pathname;
if (filename == NULL) {
filename = pathname;
} else if (!strlen(++filename)) {
filename = pathname;
}
snprintf(namebuf, MAX_STR_SIZE, "%s", filename);