mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
fix File::linkTo() on Windows
This commit is contained in:
@@ -317,8 +317,18 @@ void FileImpl::linkToImpl(const std::string& path, int type) const
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CreateSymbolicLinkA(path.c_str(), _path.c_str(), (isDirectoryImpl() ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0) | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE) == 0)
|
||||
#if _WIN32_WINNT >= 0x0600 && defined(SYMBOLIC_LINK_FLAG_DIRECTORY)
|
||||
DWORD flags = 0;
|
||||
if (isDirectoryImpl()) flags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
|
||||
#ifdef SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
|
||||
flags |= SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
|
||||
#endif
|
||||
if (CreateSymbolicLinkA(path.c_str(), _path.c_str(), flags) == 0)
|
||||
handleLastErrorImpl(_path);
|
||||
#else
|
||||
throw Poco::NotImplementedException("Symbolic link support not available in used version of the Windows SDK")
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user