From 6287679d124d63eed7735010958a9a2170c08bbf Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 13 Sep 2011 13:02:16 +0200 Subject: [PATCH] pathmax: Support for native Windows. * lib/pathmax.h (PATH_MAX): Define to 260 on native Windows. --- ChangeLog | 5 +++++ lib/pathmax.h | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3c177306c..c6bfc745d 100644 --- 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 index a1e458c12..9c3099543 100644 --- 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 */ -- 2.11.0