mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 13:02:11 +00:00
* bjam; bump to version 3.1.12 * bjam; make it possible to build in MinGW/MSYS shell * bjam; move profile code to debug.h/c to make it available for use everywhere * bjam; cache all filesystem query operations, Unix and Windows only, include PWD and scanning * bjam; add memory profile info, and sprinkle throught code * bbv2; rewrite some while() loops into for() loops to reduce time and memory * bbv2; keep a single instance counter instead of one per type to reduce memory use * bjam+bbv2; change NORMALIZE_PATH builtin to join path parts to reduce memory use [SVN r31177]
53 lines
1.1 KiB
C
53 lines
1.1 KiB
C
/* Copyright Vladimir Prus 2002, Rene Rivera 2005. Distributed under the Boost */
|
|
/* Software License, Version 1.0. (See accompanying */
|
|
/* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */
|
|
|
|
#include "jam.h"
|
|
#include "lists.h"
|
|
#include "newstr.h"
|
|
#include "pathsys.h"
|
|
|
|
#include <limits.h>
|
|
|
|
/* MinGW on windows declares PATH_MAX in limits.h */
|
|
#if defined(NT) && ! defined(__GNUC__)
|
|
#include <direct.h>
|
|
#define PATH_MAX _MAX_PATH
|
|
#else
|
|
#include <limits.h>
|
|
#include <unistd.h>
|
|
#if defined(__COMO__)
|
|
#include <linux/limits.h>
|
|
#endif
|
|
#endif
|
|
|
|
/* The current directory can't change in bjam, so optimize this to cache
|
|
** the result.
|
|
*/
|
|
static char pwd_buffer[PATH_MAX];
|
|
static char * pwd_result = NULL;
|
|
|
|
|
|
LIST*
|
|
pwd(void)
|
|
{
|
|
if (!pwd_result)
|
|
{
|
|
if (getcwd(pwd_buffer, sizeof(pwd_buffer)) == NULL)
|
|
{
|
|
perror("can not get current directory");
|
|
return L0;
|
|
}
|
|
else
|
|
{
|
|
#ifdef NT
|
|
pwd_result = short_path_to_long_path(pwd_buffer);
|
|
#else
|
|
pwd_result = newstr(pwd_buffer);
|
|
#endif
|
|
}
|
|
}
|
|
return list_new(L0, pwd_result);
|
|
}
|
|
|