Last change
on this file since 29 was
29,
checked in by landauf, 17 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
1.1 KB
|
Rev | Line | |
---|
[29] | 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) */ |
---|
| 4 | |
---|
| 5 | #include "jam.h" |
---|
| 6 | #include "lists.h" |
---|
| 7 | #include "newstr.h" |
---|
| 8 | #include "pathsys.h" |
---|
| 9 | |
---|
| 10 | #include <limits.h> |
---|
| 11 | |
---|
| 12 | /* MinGW on windows declares PATH_MAX in limits.h */ |
---|
| 13 | #if defined(NT) && ! defined(__GNUC__) |
---|
| 14 | #include <direct.h> |
---|
| 15 | #define PATH_MAX _MAX_PATH |
---|
| 16 | #else |
---|
| 17 | #include <limits.h> |
---|
| 18 | #include <unistd.h> |
---|
| 19 | #if defined(__COMO__) |
---|
| 20 | #include <linux/limits.h> |
---|
| 21 | #endif |
---|
| 22 | #endif |
---|
| 23 | |
---|
| 24 | /* The current directory can't change in bjam, so optimize this to cache |
---|
| 25 | ** the result. |
---|
| 26 | */ |
---|
| 27 | static char pwd_buffer[PATH_MAX]; |
---|
| 28 | static char * pwd_result = NULL; |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | LIST* |
---|
| 32 | pwd(void) |
---|
| 33 | { |
---|
| 34 | if (!pwd_result) |
---|
| 35 | { |
---|
| 36 | if (getcwd(pwd_buffer, sizeof(pwd_buffer)) == NULL) |
---|
| 37 | { |
---|
| 38 | perror("can not get current directory"); |
---|
| 39 | return L0; |
---|
| 40 | } |
---|
| 41 | else |
---|
| 42 | { |
---|
| 43 | #ifdef NT |
---|
| 44 | pwd_result = short_path_to_long_path(pwd_buffer); |
---|
| 45 | #else |
---|
| 46 | pwd_result = newstr(pwd_buffer); |
---|
| 47 | #endif |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | return list_new(L0, pwd_result); |
---|
| 51 | } |
---|
| 52 | |
---|
Note: See
TracBrowser
for help on using the repository browser.