1 /* Copyright Vladimir Prus 2002, Rene Rivera 2005. Distributed under the Boost */
2 /* Software License, Version 1.0. (See accompanying */
3 /* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */
14 /* MinGW on windows declares PATH_MAX in limits.h */
15 #if defined(NT) && ! defined(__GNUC__)
17 #define PATH_MAX _MAX_PATH
21 #include <linux/limits.h>
29 /* The current directory can't change in bjam, so optimize this to cache
32 static char * pwd_result = NULL;
40 int buffer_size = PATH_MAX;
41 char * result_buffer = 0;
44 char * buffer = BJAM_MALLOC_RAW(buffer_size);
45 result_buffer = getcwd(buffer,buffer_size);
49 pwd_result = short_path_to_long_path(result_buffer);
51 pwd_result = newstr(result_buffer);
55 BJAM_FREE_RAW(buffer);
57 while (!pwd_result && errno == ERANGE);
61 perror("can not get current directory");
65 return list_new(L0, pwd_result);