Classes | |
| class | StatMode |
| class | DevInoCache |
| Simple cache remembering device/inode to detect hardlinks. More... | |
| class | PathInfo |
| Wrapper class for stat/lstat. More... | |
| struct | DirEntry |
| Listentry returned by readdir. More... | |
| class | Pathname |
| Pathname. More... | |
| class | TmpPath |
| class | TmpFile |
| class | TmpDir |
Misc. | |
| enum | ZIP_TYPE { ZT_NONE, ZT_GZ, ZT_BZ2 } |
| Test whether a file is compressed (gzip/bzip2). More... | |
| int | erase (const Pathname &path) |
| Erase whatever happens to be located at path (file or directory). | |
| ZIP_TYPE | zipType (const Pathname &file) |
| ByteCount | df (const Pathname &path) |
| Report free disk space on a mounted file system. | |
| mode_t | getUmask () |
| Get the current umask (file mode creation mask). | |
| mode_t | applyUmaskTo (mode_t mode_r) |
Modify mode_r according to the current umask ( mode_r & ~getUmask() ). | |
Directory related functions. | |
| typedef std::list < DirEntry > | DirContent |
| Returned by readdir. | |
| int | mkdir (const Pathname &path, unsigned mode=0755) |
| Like 'mkdir'. | |
| int | assert_dir (const Pathname &path, unsigned mode=0755) |
| Like 'mkdir -p'. | |
| int | rmdir (const Pathname &path) |
| Like 'rmdir'. | |
| int | recursive_rmdir (const Pathname &path) |
| Like 'rm -r DIR'. | |
| int | clean_dir (const Pathname &path) |
| Like 'rm -r DIR/ *'. | |
| int | copy_dir (const Pathname &srcpath, const Pathname &destpath) |
| Like 'cp -a srcpath destpath'. | |
| int | copy_dir_content (const Pathname &srcpath, const Pathname &destpath) |
| Like 'cp -a srcpath/. | |
| int | readdir (std::list< std::string > &retlist, const Pathname &path, bool dots=true) |
| Return content of directory via retlist. | |
| int | readdir (std::list< Pathname > &retlist, const Pathname &path, bool dots=true) |
| Return content of directory via retlist. | |
| int | readdir (DirContent &retlist, const Pathname &path, bool dots=true, PathInfo::Mode statmode=PathInfo::STAT) |
| Return content of directory via retlist. | |
| int | is_empty_dir (const Pathname &path) |
| Check if the specified directory is empty. | |
Enumerations | |
| enum | FileType { FT_NOT_AVAIL = 0x00, FT_NOT_EXIST = 0x01, FT_FILE = 0x02, FT_DIR = 0x04, FT_CHARDEV = 0x08, FT_BLOCKDEV = 0x10, FT_FIFO = 0x20, FT_LINK = 0x40, FT_SOCKET = 0x80 } |
| File type information. More... | |
Functions | |
| std::ostream & | operator<< (std::ostream &str, FileType obj) |
| std::ostream & | operator<< (std::ostream &str, const StatMode &obj) |
| std::ostream & | operator<< (std::ostream &str, const PathInfo &obj) |
| int | _Log_Result (const int res, const char *rclass="errno") |
| std::string | checksum (const Pathname &file, const std::string &algorithm) |
| Compute a files checksum. | |
| bool | is_checksum (const Pathname &file, const CheckSum &checksum) |
| check files checksum | |
| std::ostream & | operator<< (std::ostream &str, const TmpPath &obj) |
| Stream output as pathname. | |
File related functions. | |
| int | unlink (const Pathname &path) |
| Like 'unlink'. | |
| int | rename (const Pathname &oldpath, const Pathname &newpath) |
| Like 'rename'. | |
| int | copy (const Pathname &file, const Pathname &dest) |
| Like 'cp file dest'. | |
| int | symlink (const Pathname &oldpath, const Pathname &newpath) |
| Like 'symlink'. | |
| int | hardlink (const Pathname &oldpath, const Pathname &newpath) |
| Like 'link'. | |
| int | copy_file2dir (const Pathname &file, const Pathname &dest) |
| Like 'cp file dest'. | |
| int | touch (const Pathname &path) |
| Change file's modification and access times. | |
Digest computaion. | |
| std::string | md5sum (const Pathname &file) |
| Compute a files md5sum. | |
| std::string | sha1sum (const Pathname &file) |
| Compute a files sha1sum. | |
Changing permissions. | |
| int | chmod (const Pathname &path, mode_t mode) |
| Like 'chmod'. | |
| typedef std::list<DirEntry> zypp::filesystem::DirContent |
File type information.
| FT_NOT_AVAIL | |
| FT_NOT_EXIST | |
| FT_FILE | |
| FT_DIR | |
| FT_CHARDEV | |
| FT_BLOCKDEV | |
| FT_FIFO | |
| FT_LINK | |
| FT_SOCKET |
Definition at line 53 of file PathInfo.h.
Test whether a file is compressed (gzip/bzip2).
Definition at line 631 of file PathInfo.h.
| std::ostream& zypp::filesystem::operator<< | ( | std::ostream & | str, | |
| FileType | obj | |||
| ) |
Definition at line 47 of file PathInfo.cc.
References EMUMOUT, FT_BLOCKDEV, FT_CHARDEV, FT_DIR, FT_FIFO, FT_FILE, FT_LINK, FT_NOT_AVAIL, FT_NOT_EXIST, and FT_SOCKET.
| std::ostream& zypp::filesystem::operator<< | ( | std::ostream & | str, | |
| const StatMode & | obj | |||
| ) |
Definition at line 95 of file PathInfo.cc.
References zypp::filesystem::StatMode::isBlk(), zypp::filesystem::StatMode::isChr(), zypp::filesystem::StatMode::isDir(), zypp::filesystem::StatMode::isFifo(), zypp::filesystem::StatMode::isFile(), zypp::filesystem::StatMode::isLink(), zypp::filesystem::StatMode::isSock(), and zypp::filesystem::StatMode::perm().
| std::ostream& zypp::filesystem::operator<< | ( | std::ostream & | str, | |
| const PathInfo & | obj | |||
| ) |
Definition at line 261 of file PathInfo.cc.
References zypp::filesystem::PathInfo::asStatMode(), zypp::filesystem::PathInfo::asString(), zypp::filesystem::PathInfo::group(), zypp::filesystem::PathInfo::isExist(), zypp::filesystem::PathInfo::isFile(), zypp::filesystem::PathInfo::owner(), and zypp::filesystem::PathInfo::size().
| int zypp::filesystem::_Log_Result | ( | const int | res, | |
| const char * | rclass = "errno" | |||
| ) | [inline] |
Definition at line 293 of file PathInfo.cc.
Referenced by chmod(), clean_dir(), copy(), copy_dir(), copy_dir_content(), copy_file2dir(), hardlink(), is_empty_dir(), mkdir(), readdir(), recursive_rmdir(), rename(), rmdir(), symlink(), touch(), and unlink().
| int zypp::filesystem::mkdir | ( | const Pathname & | path, | |
| unsigned | mode = 0755 | |||
| ) |
Like 'mkdir'.
Attempt to create a new directory named path. mode specifies the permissions to use. It is modified by the process's umask in the usual way.
Definition at line 306 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), MIL, and zypp::str::octstring().
Referenced by assert_dir(), zypp::media::MediaHandler::createAttachPoint(), and zypp::solver::detail::Testcase::createTestcase().
| int zypp::filesystem::assert_dir | ( | const Pathname & | path, | |
| unsigned | mode = 0755 | |||
| ) |
Like 'mkdir -p'.
No error if directory exists. Make parent directories as needed. mode specifies the permissions to use, if directories have to be created. It is modified by the process's umask in the usual way.
Definition at line 320 of file PathInfo.cc.
References zypp::filesystem::Pathname::asString(), zypp::filesystem::Pathname::empty(), MIL, mkdir(), zypp::str::octstring(), zypp::filesystem::Pathname::relative(), and WAR.
Referenced by zypp::RepoManager::addRepositories(), zypp::RepoManager::addRepository(), zypp::cache::CacheInitializer::CacheInitializer(), zypp::RepoManager::checkIfToRefreshMetadata(), zypp::media::MediaCurl::doGetFileCopy(), zypp::media::MediaCurl::getDir(), zypp::storage::XMLFilesBackend::initBackend(), zypp::RepoManager::modifyRepository(), zypp::RepoManager::refreshMetadata(), zypp::RepoManager::removeRepository(), and zypp::Fetcher::Impl::start().
| int zypp::filesystem::rmdir | ( | const Pathname & | path | ) |
Like 'rmdir'.
Delete a directory, which must be empty.
Definition at line 366 of file PathInfo.cc.
References _Log_Result(), and MIL.
Referenced by zypp::media::MediaHandler::checkAttachPoint(), zypp::media::MediaHandler::createAttachPoint(), and zypp::media::MediaCurl::MediaCurl().
| int zypp::filesystem::recursive_rmdir | ( | const Pathname & | path | ) |
Like 'rm -r DIR'.
Delete a directory, recursively removing its contents.
Definition at line 380 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::PathInfo::isDir(), zypp::filesystem::PathInfo::isExist(), MIL, and WAR.
Referenced by zypp::RepoManager::cleanMetadata(), erase(), zypp::media::MediaHandler::releasePath(), zypp::media::MediaHandler::removeAttachPoint(), and zypp::filesystem::TmpPath::Impl::~Impl().
| int zypp::filesystem::clean_dir | ( | const Pathname & | path | ) |
Like 'rm -r DIR/ *'.
Delete directory contents, but keep the directory itself.
Definition at line 412 of file PathInfo.cc.
References _Log_Result(), zypp::ExternalProgram::close(), zypp::str::form(), zypp::filesystem::PathInfo::isDir(), zypp::filesystem::PathInfo::isExist(), MIL, zypp::externalprogram::ExternalDataSource::receiveLine(), and zypp::ExternalProgram::Stderr_To_Stdout.
Referenced by zypp::solver::detail::Testcase::createTestcase(), zypp::media::MediaHandler::releasePath(), and zypp::filesystem::TmpPath::Impl::~Impl().
| int zypp::filesystem::copy_dir | ( | const Pathname & | srcpath, | |
| const Pathname & | destpath | |||
| ) |
Like 'cp -a srcpath destpath'.
Copy directory tree. srcpath/destpath must be directories. 'basename srcpath' must not exist in destpath.
Definition at line 439 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), zypp::filesystem::Pathname::basename(), zypp::ExternalProgram::close(), zypp::filesystem::PathInfo::isDir(), MIL, zypp::externalprogram::ExternalDataSource::receiveLine(), and zypp::ExternalProgram::Stderr_To_Stdout.
| int zypp::filesystem::copy_dir_content | ( | const Pathname & | srcpath, | |
| const Pathname & | destpath | |||
| ) |
Like 'cp -a srcpath/.
destpath'. Copy the content of srcpath recursively into destpath. Both srcpath and destpath has to exists.
Definition at line 480 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), zypp::ExternalProgram::close(), zypp::filesystem::PathInfo::isDir(), MIL, zypp::externalprogram::ExternalDataSource::receiveLine(), and zypp::ExternalProgram::Stderr_To_Stdout.
| int zypp::filesystem::readdir | ( | std::list< std::string > & | retlist, | |
| const Pathname & | path, | |||
| bool | dots = true | |||
| ) |
Return content of directory via retlist.
If dots is false entries starting with '.' are not reported. "." and ".." are never reported.
Returns just the directory entries as string.
Definition at line 521 of file PathInfo.cc.
References _Log_Result(), and MIL.
Referenced by zypp::parser::plaindir::RepoParser::Impl::extract_packages_from_directory(), is_empty_dir(), readdir(), zypp::parser::plaindir::recursive_timestamp(), and zypp::media::MediaDISK::verifyIfDiskVolume().
| int zypp::filesystem::readdir | ( | std::list< Pathname > & | retlist, | |
| const Pathname & | path, | |||
| bool | dots = true | |||
| ) |
Return content of directory via retlist.
If dots is false entries starting with '.' are not reported. "." and ".." are never reported.
Returns the directory entries prefixed with path.
Definition at line 558 of file PathInfo.cc.
References readdir().
| int zypp::filesystem::readdir | ( | DirContent & | retlist, | |
| const Pathname & | path, | |||
| bool | dots = true, |
|||
| PathInfo::Mode | statmode = PathInfo::STAT | |||
| ) |
Return content of directory via retlist.
If dots is false entries starting with '.' are not reported. "." and ".." are never reported.
The type of individual directory entries is determined accoding to statmode (i.e. via stat or lstat).
Definition at line 580 of file PathInfo.cc.
References zypp::filesystem::PathInfo::fileType(), and readdir().
Referenced by zypp::target::modalias::foreach_file(), zypp::media::MediaHandler::getDirInfo(), zypp::repositories_in_dir(), and zypp::storage::XMLFilesBackend::storedObjects().
| int zypp::filesystem::is_empty_dir | ( | const Pathname & | path | ) |
Check if the specified directory is empty.
| path | The path of the directory to check. |
Definition at line 603 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), name, and readdir().
Referenced by zypp::media::MediaHandler::checkAttachPoint().
| int zypp::filesystem::unlink | ( | const Pathname & | path | ) |
Like 'unlink'.
Delete a file (symbolic link, socket, fifo or device).
Definition at line 630 of file PathInfo.cc.
References _Log_Result(), and MIL.
Referenced by zypp::storage::XMLFilesBackend::deleteFileObject(), zypp::target::CommitPackageCacheReadAhead::doCacheLastInteractive(), zypp::media::MediaCurl::doGetFileCopy(), zypp::repo::doProvideScript(), zypp::repo::doProvideSrcPackage(), erase(), zypp::applydeltarpm::provide(), zypp::repo::RepoMediaAccess::provideFile(), zypp::media::MediaHandler::releasePath(), zypp::RepoManager::removeRepository(), zypp::target::rpm::RpmDb::removeV3(), zypp::target::rpm::RpmDb::removeV4(), zypp::repo::PackageProvider::tryDelta(), zypp::ZYppGlobalLock::zyppLocked(), zypp::filesystem::TmpPath::Impl::~Impl(), and zypp::ZYppGlobalLock::~ZYppGlobalLock().
| int zypp::filesystem::rename | ( | const Pathname & | oldpath, | |
| const Pathname & | newpath | |||
| ) |
Like 'rename'.
Renames a file, moving it between directories if required.
Definition at line 644 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), and MIL.
Referenced by zypp::media::MediaCurl::doGetFileCopy(), zypp::RepoManager::refreshMetadata(), and zypp::target::rpm::RpmDb::removeV3().
| int zypp::filesystem::copy | ( | const Pathname & | file, | |
| const Pathname & | dest | |||
| ) |
Like 'cp file dest'.
Copy file to destination file.
Definition at line 658 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), zypp::ExternalProgram::close(), zypp::filesystem::PathInfo::isDir(), zypp::filesystem::PathInfo::isFile(), MIL, zypp::externalprogram::ExternalDataSource::receiveLine(), and zypp::ExternalProgram::Stderr_To_Stdout.
Referenced by zypp::url::UrlBase::cleanupPathName(), zypp::parser::susetags::PackagesFileReader::Impl::consumeKwd(), zypp::target::CommitPackageCacheReadAhead::doCacheLastInteractive(), zypp::media::MediaHandler::getFileCopy(), zypp::target::rpm::RpmDb::internal_initDatabase(), zypp::operator<<(), zypp::PublicKey::Impl::readFromFile(), zypp::target::rpm::RpmDb::run_rpm(), and zypp::Fetcher::Impl::start().
| int zypp::filesystem::symlink | ( | const Pathname & | oldpath, | |
| const Pathname & | newpath | |||
| ) |
Like 'symlink'.
Creates a symbolic link named newpath which contains the string oldpath. If newpath exists it will not be overwritten.
Definition at line 692 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), and MIL.
| int zypp::filesystem::hardlink | ( | const Pathname & | oldpath, | |
| const Pathname & | newpath | |||
| ) |
Like 'link'.
Creates a hard link named newpath to an existing file oldpath. If newpath exists it will not be overwritten.
Definition at line 706 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), and MIL.
| int zypp::filesystem::copy_file2dir | ( | const Pathname & | file, | |
| const Pathname & | dest | |||
| ) |
Like 'cp file dest'.
Copy file to dest dir.
Definition at line 720 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), zypp::ExternalProgram::close(), zypp::filesystem::PathInfo::isDir(), zypp::filesystem::PathInfo::isFile(), MIL, zypp::externalprogram::ExternalDataSource::receiveLine(), and zypp::ExternalProgram::Stderr_To_Stdout.
| std::string zypp::filesystem::md5sum | ( | const Pathname & | file | ) |
Compute a files md5sum.
Definition at line 754 of file PathInfo.cc.
References zypp::filesystem::Pathname::asString(), zypp::Digest::digest(), zypp::filesystem::PathInfo::isFile(), and zypp::filesystem::PathInfo::PathInfo().
| std::string zypp::filesystem::sha1sum | ( | const Pathname & | file | ) |
Compute a files sha1sum.
Definition at line 771 of file PathInfo.cc.
References checksum().
Referenced by zypp::RepoStatus::RepoStatus().
| std::string zypp::filesystem::checksum | ( | const Pathname & | file, | |
| const std::string & | algorithm | |||
| ) |
Compute a files checksum.
Definition at line 781 of file PathInfo.cc.
References zypp::filesystem::Pathname::asString(), zypp::Digest::digest(), zypp::filesystem::PathInfo::isFile(), and zypp::filesystem::PathInfo::PathInfo().
Referenced by zypp::repo::cached::RepoImpl::createPatchAndDeltas(), FnAdler32(), is_checksum(), zypp::ChecksumFileChecker::operator()(), zypp::PublicKey::Impl::readFromFile(), and sha1sum().
| bool zypp::filesystem::is_checksum | ( | const Pathname & | file, | |
| const CheckSum & | checksum | |||
| ) |
check files checksum
Definition at line 793 of file PathInfo.cc.
References zypp::CheckSum::checksum(), checksum(), and zypp::CheckSum::type().
Referenced by zypp::Fetcher::Impl::start().
| int zypp::filesystem::erase | ( | const Pathname & | path | ) |
Erase whatever happens to be located at path (file or directory).
Definition at line 803 of file PathInfo.cc.
References zypp::filesystem::PathInfo::isDir(), zypp::filesystem::PathInfo::isExist(), zypp::filesystem::PathInfo::LSTAT, recursive_rmdir(), and unlink().
| int zypp::filesystem::chmod | ( | const Pathname & | path, | |
| mode_t | mode | |||
| ) |
Like 'chmod'.
The mode of the file given by path is changed.
Definition at line 822 of file PathInfo.cc.
References _Log_Result(), zypp::filesystem::Pathname::asString(), MIL, and zypp::str::octstring().
Referenced by zypp::repo::doProvideScript(), zypp::repo::doProvideSrcPackage(), zypp::target::ExecuteScriptHelper(), zypp::base::logger::FileWriter::FileWriter(), zypp::filesystem::TmpDir::makeSibling(), and zypp::filesystem::TmpFile::makeSibling().
| ZIP_TYPE zypp::filesystem::zipType | ( | const Pathname & | file | ) |
Definition at line 836 of file PathInfo.cc.
References zypp::filesystem::Pathname::asString(), zypp::base::sysconfig::read(), ZT_BZ2, ZT_GZ, and ZT_NONE.
Referenced by zypp::_heplerInitSize().
| ByteCount zypp::filesystem::df | ( | const Pathname & | path | ) |
Report free disk space on a mounted file system.
path is the path name of any file within the mounted filesystem.
Definition at line 864 of file PathInfo.cc.
References zypp::filesystem::Pathname::c_str().
Referenced by zypp::target::CommitPackageCacheReadAhead::doCacheLastInteractive().
| mode_t zypp::filesystem::getUmask | ( | ) |
Get the current umask (file mode creation mask).
Definition at line 880 of file PathInfo.cc.
Referenced by applyUmaskTo().
| int zypp::filesystem::touch | ( | const Pathname & | path | ) |
Change file's modification and access times.
Definition at line 892 of file PathInfo.cc.
References _Log_Result(), and MIL.
Referenced by zypp::RepoManager::touchIndexFile().
| mode_t zypp::filesystem::applyUmaskTo | ( | mode_t | mode_r | ) | [inline] |
Modify mode_r according to the current umask ( mode_r & ~getUmask() ).
Definition at line 666 of file PathInfo.h.
References getUmask().
Referenced by zypp::media::MediaCurl::doGetFileCopy().
| std::ostream& zypp::filesystem::operator<< | ( | std::ostream & | str, | |
| const TmpPath & | obj | |||
| ) | [inline] |
1.5.3