diff options
author | Lautis Sun <lautis0503@gmail.com> | 2016-09-07 19:12:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-07 19:12:13 +0300 |
commit | d4d5eb2d07762457096f602d8fa2ffaa81397b10 (patch) | |
tree | ef3be259d7c20c96b21f47ad9fa9dbb115cc2f92 | |
parent | 2887d68125cbcc0ca0ce0602b13079254cadf06e (diff) |
Define _TINYDIR_PATH_MAX as OS supports
-rw-r--r-- | tinydir.h | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -84,15 +84,27 @@ extern "C" { #define _tinydir_strncmp strncmp #endif -#define _TINYDIR_PATH_MAX 4096 +#if (defined _MSC_VER || defined __MINGW32__) +#include <windows.h> +#define PATH_MAX MAX_PATH +#elif defined __linux__ +#include <linux/limits.h> +#endif +#define _TINYDIR_PATH_MAX PATH_MAX + #ifdef _MSC_VER /* extra chars for the "\\*" mask */ # define _TINYDIR_PATH_EXTRA 2 #else # define _TINYDIR_PATH_EXTRA 0 #endif + #define _TINYDIR_FILENAME_MAX 256 +#if (defined _MSC_VER || defined __MINGW32__) +#define _TINYDIR_DRIVE_MAX 3 +#endif + #ifdef _MSC_VER # define _TINYDIR_FUNC static __inline #elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L @@ -626,7 +638,7 @@ int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path) #if ((defined _MSC_VER) && (_MSC_VER >= 1400)) _tsplitpath_s( path, - drive_buf, _TINYDIR_PATH_MAX, + drive_buf, _TINYDIR_DRIVE_MAX, dir_name_buf, _TINYDIR_PATH_MAX, file_name_buf, _TINYDIR_FILENAME_MAX, ext_buf, sizeof _TINYDIR_FILENAME_MAX); |