Oops, get_current_dir_name() isn't available outside Linux; it even

says so in the documentation.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2508 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-05-28 18:17:41 +00:00
parent f60524770a
commit c63117c38d
1 changed files with 4 additions and 2 deletions

View File

@ -162,10 +162,13 @@ POSIXFilesystemNode::POSIXFilesystemNode(const string& p, bool verify)
else if ((p.length() >= 2 && p[0] == '.' && p[1] == '/') || else if ((p.length() >= 2 && p[0] == '.' && p[1] == '/') ||
(p.length() >= 1 && p[0] != '/')) (p.length() >= 1 && p[0] != '/'))
{ {
char* cwd = get_current_dir_name();
#ifdef MAXPATHLEN #ifdef MAXPATHLEN
char buf[MAXPATHLEN];
const char* cwd = getcwd(buf, MAXPATHLEN);
if (cwd != NULL && strlen(cwd) < MAXPATHLEN) if (cwd != NULL && strlen(cwd) < MAXPATHLEN)
#else // No MAXPATHLEN, as happens on Hurd #else // No MAXPATHLEN, as happens on Hurd
char buf[1024];
const char* cwd = getcwd(buf, 1024);
if (cwd != NULL) if (cwd != NULL)
#endif #endif
{ {
@ -177,7 +180,6 @@ POSIXFilesystemNode::POSIXFilesystemNode(const string& p, bool verify)
else else
_path = _path + '/' + p; _path = _path + '/' + p;
} }
free(cwd);
} }
else else
_path = p; _path = p;