diff --git a/src/configdir.c b/src/configdir.c index 4bb2411..f569ca9 100644 --- a/src/configdir.c +++ b/src/configdir.c @@ -30,14 +30,8 @@ #include #include #include - -#ifdef _WIN32 -#include -#include -#else /* WIN32 */ #include #include -#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 } diff --git a/src/configdir.h b/src/configdir.h index 6a1a7eb..ad4daf8 100644 --- a/src/configdir.h +++ b/src/configdir.h @@ -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) diff --git a/src/main.c b/src/main.c index cbe9fd7..f979c4f 100644 --- a/src/main.c +++ b/src/main.c @@ -40,18 +40,11 @@ #include #include #include - -#ifdef _WIN32 -#include -#include -#include -#else #include #include #include #include #include -#endif #include diff --git a/src/misc_tools.c b/src/misc_tools.c index e401010..a1e562e 100644 --- a/src/misc_tools.c +++ b/src/misc_tools.c @@ -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);