GH 30:Poco::Path::home() throws

GH #30: Poco::Path::home() throws when called from Windows Service
done for Win32 and Win32U, return root for WinCE
This commit is contained in:
aleks-f
2012-12-14 12:09:23 -06:00
parent dbc847eb62
commit 5d463c3a1c
10 changed files with 103 additions and 36 deletions

View File

@@ -58,19 +58,9 @@ std::string PathImpl::homeImpl()
}
std::string PathImpl::tempImpl()
std::string PathImpl::systemImpl()
{
Buffer<wchar_t> buffer(MAX_PATH_LEN);
DWORD n = GetTempPathW(static_cast<DWORD>(buffer.size()), buffer.begin());
if (n > 0)
{
std::string result;
UnicodeConverter::toUTF8(buffer.begin(), result);
if (result[n - 1] != '\\')
result.append("\\");
return result;
}
throw SystemException("Cannot get current directory");
return("\\");
}