Merge lethosor stuff. For some reason, git's auto merge message didn't happen because of git-stash shenanigans. Oh well.

develop
expwnent 2014-06-19 22:58:17 -04:00
parent f72b52c5c0
commit 036aae060b
2 changed files with 7 additions and 7 deletions

@ -182,7 +182,7 @@ enum _filetype {
namespace DFHack { namespace DFHack {
namespace Filesystem { namespace Filesystem {
DFHACK_EXPORT bool chdir (std::string path); DFHACK_EXPORT bool chdir (std::string path);
DFHACK_EXPORT char * getcwd (); DFHACK_EXPORT std::string getcwd ();
DFHACK_EXPORT bool mkdir (std::string path); DFHACK_EXPORT bool mkdir (std::string path);
DFHACK_EXPORT bool rmdir (std::string path); DFHACK_EXPORT bool rmdir (std::string path);
DFHACK_EXPORT bool stat (std::string path, STAT_STRUCT &info); DFHACK_EXPORT bool stat (std::string path, STAT_STRUCT &info);

@ -54,18 +54,18 @@ bool DFHack::Filesystem::chdir (std::string path)
return !(bool)::chdir(path.c_str()); return !(bool)::chdir(path.c_str());
} }
char * DFHack::Filesystem::getcwd () std::string DFHack::Filesystem::getcwd ()
{ {
char *path; char *path;
char buf[LFS_MAXPATHLEN]; char buf[LFS_MAXPATHLEN];
std::string result = "";
#ifdef _WIN32 #ifdef _WIN32
if ((path = ::_getcwd(buf, LFS_MAXPATHLEN)) == NULL) if ((path = ::_getcwd(buf, LFS_MAXPATHLEN)) != NULL)
#else #else
if ((path = ::getcwd(buf, LFS_MAXPATHLEN)) == NULL) if ((path = ::getcwd(buf, LFS_MAXPATHLEN)) != NULL)
#endif #endif
return NULL; result = buf;
else return result;
return path;
} }
bool DFHack::Filesystem::mkdir (std::string path) bool DFHack::Filesystem::mkdir (std::string path)