Exemple #1
0
void FileImpl::linkToImpl(const std::string& path, int type) const
{
	poco_assert (!_path.empty());

	if (type == 0)
	{
		if (CreateHardLinkA(path.c_str(), _path.c_str(), NULL) == 0)
			handleLastErrorImpl(_path);
	}
	else
	{
#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

	}
}
Exemple #2
0
bool FileImpl::createDirectoryImpl()
{
	poco_assert (!_path.empty());
	
	if (existsImpl() && isDirectoryImpl())
		return false;
	if (CreateDirectoryA(_path.c_str(), 0) == 0)
		handleLastErrorImpl(_path);
	return true;
}
Exemple #3
0
bool FileImpl::createDirectoryImpl()
{
	poco_assert (!_path.empty());

	if (existsImpl() && isDirectoryImpl())
		return false;
	if (mkdir(_path.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) != 0) 
		handleLastErrorImpl(_path);
	return true;
}
Exemple #4
0
void FileImpl::removeImpl()
{
    poco_assert (!_path.empty());

    int rc;
    if (!isLinkImpl() && isDirectoryImpl())
        rc = rmdir(_path.c_str());
    else
        rc = unlink(const_cast<char*>(_path.c_str()));
    if (rc) handleLastErrorImpl(_path);
}
Exemple #5
0
bool FileImpl::createDirectoryImpl()
{
	poco_assert (!_path.empty());

	if (existsImpl() && isDirectoryImpl())
		return false;
	Path p(_path);
	p.makeDirectory();
	if (mkdir(p.toString().c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) 
		handleLastErrorImpl(_path);
	return true;
}
Exemple #6
0
void FileImpl::removeImpl()
{
	poco_assert (!_path.empty());

	if (isDirectoryImpl())
	{
		if (RemoveDirectoryA(_path.c_str()) == 0) 
			handleLastErrorImpl(_path);
	}
	else
	{
		if (DeleteFileA(_path.c_str()) == 0)
			handleLastErrorImpl(_path);
	}
}
Exemple #7
0
void FileImpl::removeImpl()
{
	poco_assert (!_path.empty());

	int rc;
	if (isDirectoryImpl())
	{
		setWriteableImpl(true);
		rc = rmdir(_path.c_str());
	}
	else
	{
		rc = unlink(_path.c_str());
	}
	if (rc) handleLastErrorImpl(_path);
}
Exemple #8
0
bool FileImpl::isFileImpl() const
{
	return !isDirectoryImpl() && !isDeviceImpl();
}
Exemple #9
0
bool File::isDirectory() const
{
	return isDirectoryImpl();
}