# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1618085503 0 # Node ID 44b77654c406df99223e88268308fc0984cccba0 # Parent 2c03987c95bdda300114b04e3611c7c62d3c6c19 Add DW_DIR_SEPARATOR for easy access to the separator characters. There is something similar in dwcompat.h but I don't want to require including dwcompat.h on Unix, in case dwcompat isn't built. diff -r 2c03987c95bd -r 44b77654c406 dw.h --- a/dw.h Sat Apr 10 20:09:58 2021 +0000 +++ b/dw.h Sat Apr 10 20:11:43 2021 +0000 @@ -347,8 +347,8 @@ #include #include -/* Unfortunately using we can't import Cocoa.h - * or UIKit.h from C code, so we have to instead +/* Unfortunately we can't import Cocoa.h or + * UIKit.h from C code, so we have to instead * use opaque types and use the values from * the headers here directly without using the * symbolic names. @@ -1359,8 +1359,11 @@ typedef CTIME *PCTIME; #endif -#if defined(__OS2__) || (defined(__WIN32__) && !defined(GDK_WINDOWING_WIN32)) || (defined(WINNT) && !defined(GDK_WINDOWING_WIN32)) || defined(__EMX__) +/* Define a few things missing on OS/2 and Windows */ +#if defined(__OS2__) || (defined(__WIN32__) && !defined(GDK_WINDOWING_WIN32)) || \ + (defined(WINNT) && !defined(GDK_WINDOWING_WIN32)) || defined(__EMX__) typedef unsigned long DWTID; +#define DW_DIR_SEPARATOR '\\' #endif /* Some dark mode constants for supported platforms */ @@ -1577,6 +1580,10 @@ #define DW_FCF_COMPOSITED 0 #endif +#ifndef DW_DIR_SEPARATOR +#define DW_DIR_SEPARATOR '/' +#endif + #ifndef API #define API #endif diff -r 2c03987c95bd -r 44b77654c406 dwtest.c --- a/dwtest.c Sat Apr 10 20:09:58 2021 +0000 +++ b/dwtest.c Sat Apr 10 20:11:43 2021 +0000 @@ -1151,11 +1151,7 @@ int pos = (int)strlen(appdir); strncpy(pathbuff, appdir, 1024); -#if defined(__OS2__) || defined(__WIN32__) - pathbuff[pos] = '\\'; -#else - pathbuff[pos] = '/'; -#endif + pathbuff[pos] = DW_DIR_SEPARATOR; pos++; strncpy(&pathbuff[pos], "test", 1024-pos); image = dw_pixmap_new_from_file(textbox2, pathbuff); @@ -2151,11 +2147,7 @@ int pos = (int)strlen(appdir); strncpy(pathbuff, appdir, 1024); -#if defined(__OS2__) || defined(__WIN32__) - pathbuff[pos] = '\\'; -#else - pathbuff[pos] = '/'; -#endif + pathbuff[pos] = DW_DIR_SEPARATOR; pos++; strncpy(&pathbuff[pos], FOLDER_ICON_NAME, 1024-pos); foldericon = dw_icon_load_from_file(pathbuff);