+ if getcwd fails then use '.'

This commit is contained in:
wmayer 2016-05-11 09:24:29 +02:00
parent f3a5deec5e
commit d7d347b2d6

View File

@ -233,14 +233,13 @@ std::string FileInfo::dirPath () const
}
else {
#ifdef FC_OS_WIN32
wchar_t buf[MAX_PATH];
wchar_t buf[MAX_PATH+1];
GetCurrentDirectoryW(MAX_PATH, buf);
retval = std::string(ConvertFromWideString(std::wstring(buf)));
#else
char buf[PATH_MAX+1];
const char* cwd = getcwd(buf, PATH_MAX);
if (cwd)
retval = std::string(cwd);
retval = std::string(cwd ? cwd : ".");
#endif
}
return retval;