- #1196 Now builds on Hurd (thanks to Jakub Wilk).
This commit is contained in:
Paul Beckingham 2013-04-09 20:50:05 -04:00
parent 773b55d374
commit 0ea28ef8a3
4 changed files with 17 additions and 0 deletions

View file

@ -30,6 +30,8 @@
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <Directory.h>
#include <cmake.h>
@ -148,9 +150,18 @@ std::vector <std::string> Directory::listRecursive ()
////////////////////////////////////////////////////////////////////////////////
std::string Directory::cwd ()
{
#ifdef HAVE_GET_CURRENT_DIR_NAME
char *buf = get_current_dir_name ();
if (buf == NULL)
throw std::bad_alloc ();
std::string result (buf);
free (buf);
return result;
#else
char buf[PATH_MAX];
getcwd (buf, PATH_MAX - 1);
return std::string (buf);
#endif
}
////////////////////////////////////////////////////////////////////////////////