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 } }
bool FileImpl::createDirectoryImpl() { poco_assert (!_path.empty()); if (existsImpl() && isDirectoryImpl()) return false; if (CreateDirectoryA(_path.c_str(), 0) == 0) handleLastErrorImpl(_path); return true; }
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; }
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); }
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; }
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); } }
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); }
bool FileImpl::isFileImpl() const { return !isDirectoryImpl() && !isDeviceImpl(); }
bool File::isDirectory() const { return isDirectoryImpl(); }