mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 02:22:57 +01:00
fixed #627: Poco::Path::home() returns c:\windows\system32 instead home directory
This commit is contained in:
parent
10aedfe5ad
commit
a5c8b751d9
@ -55,14 +55,16 @@ std::string PathImpl::systemImpl()
|
||||
std::string PathImpl::homeImpl()
|
||||
{
|
||||
std::string result;
|
||||
|
||||
// windows service has no home dir, return system directory instead
|
||||
try
|
||||
if (EnvironmentImpl::hasImpl("HOMEDRIVE") && EnvironmentImpl::hasImpl("HOMEPATH"))
|
||||
{
|
||||
result = EnvironmentImpl::getImpl("HOMEDRIVE");
|
||||
result.append(EnvironmentImpl::getImpl("HOMEPATH"));
|
||||
}
|
||||
catch (NotFoundException&)
|
||||
else if (EnvironmentImpl::hasImpl("USERPROFILE"))
|
||||
{
|
||||
result = EnvironmentImpl::getImpl("USERPROFILE");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = systemImpl();
|
||||
}
|
||||
|
@ -65,14 +65,16 @@ std::string PathImpl::systemImpl()
|
||||
std::string PathImpl::homeImpl()
|
||||
{
|
||||
std::string result;
|
||||
|
||||
// windows service has no home dir, return system directory instead
|
||||
try
|
||||
if (EnvironmentImpl::hasImpl("HOMEDRIVE") && EnvironmentImpl::hasImpl("HOMEPATH"))
|
||||
{
|
||||
result = EnvironmentImpl::getImpl("HOMEDRIVE");
|
||||
result.append(EnvironmentImpl::getImpl("HOMEPATH"));
|
||||
}
|
||||
catch (NotFoundException&)
|
||||
else if (EnvironmentImpl::hasImpl("USERPROFILE"))
|
||||
{
|
||||
result = EnvironmentImpl::getImpl("USERPROFILE");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = systemImpl();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user