# HG changeset patch # User Bruno Haible # Date 1315911736 -7200 # Node ID ddf0241e1a64b121a54d5fcfce25279703589372 # Parent de2ecfd7fc4a342b3bdfb0831706f16397358012 pathmax: Support for native Windows. * lib/pathmax.h (PATH_MAX): Define to 260 on native Windows. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-09-13 Bruno Haible + + pathmax: Support for native Windows. + * lib/pathmax.h (PATH_MAX): Define to 260 on native Windows. + 2011-09-12 Bruno Haible New modules 'opendir', 'readdir', 'rewinddir', 'closedir'. diff --git a/lib/pathmax.h b/lib/pathmax.h --- a/lib/pathmax.h +++ b/lib/pathmax.h @@ -66,4 +66,19 @@ # define PATH_MAX 1024 # endif +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, + section "Maximum Path Length Limitation", + + explains that the maximum size of a filename, including the terminating + NUL byte, is 260 = 3 + 256 + 1. + This is the same value as + - FILENAME_MAX in , + - _MAX_PATH in , + - MAX_PATH in . + Undefine the original value, because mingw's gets it wrong. */ +# undef PATH_MAX +# define PATH_MAX 260 +# endif + #endif /* _PATHMAX_H */