# HG changeset patch # User Matti Hamalainen # Date 1455234004 -7200 # Node ID eb3692d85ac286c74dc0c4f485539d5c603ae4f9 # Parent 41bfde66634d227f89a1aae0a3d91143baf89ab4 Use TH_PLAT_WINDOWS for preprocessor conditionals. diff -r 41bfde66634d -r eb3692d85ac2 main.c --- a/main.c Thu Feb 11 23:00:26 2016 +0200 +++ b/main.c Fri Feb 12 01:40:04 2016 +0200 @@ -10,7 +10,7 @@ #include "ui.h" #include #include -#ifdef __WIN32 +#ifdef TH_PLAT_WINDOWS # include # include #else @@ -19,7 +19,7 @@ # include #endif -#ifdef __WIN32 +#ifdef TH_PLAT_WINDOWS # define SET_CONFIG_FILE "nnchat.txt" # define SET_LOG_DIR "NNChat Log Files" # define SET_DIR_SEPARATOR '\\' @@ -930,7 +930,7 @@ int nn_open_uri(const char *uri) { -#ifdef __WIN32 +#ifdef TH_PLAT_WINDOWS HINSTANCE status; status = ShellExecute(NULL, "open", uri, NULL, NULL, SW_SHOWNA); @@ -1266,7 +1266,7 @@ (void) conn; (void) buf; th_ioctx_t ctx; -#ifndef __WIN32 +#ifndef TH_PLAT_WINDOWS int cfgfd = -1; #endif @@ -1829,7 +1829,7 @@ BOOL nn_log_open(nn_window_t *win) { char *path = NULL, *plt; -#ifndef __WIN32 +#ifndef TH_PLAT_WINDOWS int logFd = -1; #endif @@ -1884,7 +1884,7 @@ if (win->logFilename == NULL) goto error; -#ifdef __WIN32 +#ifdef TH_PLAT_WINDOWS if ((win->logFile = fopen(win->logFilename, "a")) == NULL) #else if ((logFd = open(win->logFilename, O_CREAT | O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR)) == -1 || @@ -1908,7 +1908,7 @@ win->logFilename = NULL; if (win->logFile != NULL) fclose(win->logFile); -#ifndef __WIN32 +#ifndef TH_PLAT_WINDOWS else if (logFd >= 0) close(logFd); @@ -1937,7 +1937,7 @@ BOOL nn_stat_path(const char *path, BOOL *isDirectory, BOOL *isWritable, BOOL *isReadable) { -#ifdef __WIN32 +#ifdef TH_PLAT_WINDOWS DWORD attr = GetFileAttributes(path); *isDirectory = (attr & FILE_ATTRIBUTE_DIRECTORY) != 0; @@ -1985,7 +1985,7 @@ if (!exists) { -#ifdef __WIN32 +#ifdef TH_PLAT_WINDOWS if (!CreateDirectory(path, NULL)) goto error; #else @@ -2098,7 +2098,7 @@ // Get home directory path { -#if defined(__WIN32) +#if defined(TH_PLAT_WINDOWS) char tmpPath[MAX_PATH]; if (SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, tmpPath) == S_OK) setHomeDir = th_strdup(tmpPath); @@ -2164,7 +2164,7 @@ else if (!isWritable) { -#ifdef __WIN32 +#ifdef TH_PLAT_WINDOWS if (!nn_mkdir_rec(optLogPath)) { THERR("Could not create log file directory '%s'.\n", @@ -2435,7 +2435,7 @@ nnwin_shutdown(); -#ifndef __WIN32 +#ifndef TH_PLAT_WINDOWS if (errorMessages) THERR("%s", errorMessages); #endif