Only throw an expection if buf == NULL..

This commit is contained in:
Erik Hofman 2016-06-07 12:59:16 +02:00
parent dc1696dfd5
commit c722f90848

View File

@ -92,8 +92,10 @@ Dir Dir::current()
#else #else
char *buf = ::getcwd(NULL, 0); char *buf = ::getcwd(NULL, 0);
#endif #endif
if (!buf && errno == 2) sg_exception("The current directory is invalid"); if (!buf) {
else throw sg_exception(strerror(errno)); if (errno == 2) sg_exception("The current directory is invalid");
else throw sg_exception(strerror(errno));
}
SGPath p(buf); SGPath p(buf);
free(buf); free(buf);