libzypp: zypp::filesystem Namespace Reference

libzypp 17.38.14

zypp::filesystem Namespace Reference

Types and functions for filesystem operations. More...

## Classes
class | DevInoCache
| Simple cache remembering device/inode to detect hardlinks. More...
struct | DirEntry
| Listentry returned by readdir. More...
class | Glob
| Find pathnames matching a pattern. More...
class | PathInfo
| Wrapper class for ::stat/::lstat. More...
class | Pathname
| Pathname. More...
class | StatMode
| Wrapper class for mode_t values as derived from ::stat. More...
class | TmpDir
| Provide a new empty temporary directory and recursively delete it when no longer needed. More...
class | TmpFile
| Provide a new empty temporary file and delete it when no longer needed. More...
class | TmpPath
| Automatically deletes files or directories when no longer needed. More...

## 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, const Glob &obj)
| relates: Glob Stream output
std::ostream & | operator<< (std::ostream &str, const Glob::const_iterator &obj)
| relates: Glob::const_iterator Stream output
| ZYPP_DECLARE_OPERATORS_FOR_FLAGS (Glob::Flags)
const StrMatcher & | matchNoDots ()
| Convenience returning StrMatcher( "[^.]*", Match::GLOB ).
int | dirForEach (const Pathname &dir_r, const StrMatcher &matcher_r, function< bool(const Pathname &, const char *const)> fnc_r)
std::ostream & | operator<< (std::ostream &str, FileType obj) ZYPP_API
| relates: FileType Stram output.
std::ostream & | operator<< (std::ostream &str, const StatMode &obj)
| relates: StatMode Stream output.
std::ostream & | operator<< (std::ostream &str, const PathInfo &obj)
| relates: PathInfo Stream output.
static int | recursive_rmdir_1 (const Pathname &dir, bool removeDir=true)
template<typename F>
int | dirForEachImpl (const Pathname &dir_r, F &&fnc_r)
std::ostream & | operator<< (std::ostream &str, const TmpPath &obj)
| relates: TmpPath Stream output as pathname.
bool | operator== (const Pathname &l, const Pathname &r)
| relates: Pathname
bool | operator!= (const Pathname &l, const Pathname &r)
| relates: Pathname
Pathname | operator/ (const Pathname &l, const Pathname &r)
| relates: Pathname Concatenate two Pathname.
Pathname | operator+ (const Pathname &l, const Pathname &r)
| relates: Pathname Concatenate two Pathname.
bool | operator< (const Pathname &l, const Pathname &r)
| relates: Pathname
std::ostream & | operator<< (std::ostream &str, const Pathname &obj)
| relates: Pathname Stream output
File related functions.
int | unlink (const Pathname &path) ZYPP_API
| Like '::unlink'.
int | rename (const Pathname &oldpath, const Pathname &newpath) ZYPP_API
| Like '::rename'.
int | exchange (const Pathname &lpath, const Pathname &rpath)
| Exchanges two files or directories.
int | copy (const Pathname &file, const Pathname &dest) ZYPP_API
| Like 'cp file dest'.
int | symlink (const Pathname &oldpath, const Pathname &newpath) ZYPP_API
| Like '::symlink'.
int | hardlink (const Pathname &oldpath, const Pathname &newpath) ZYPP_API
| Like '::link'.
int | hardlinkCopy (const Pathname &oldpath, const Pathname &newpath) ZYPP_API
| Create newpath as hardlink or copy of oldpath.
int | readlink (const Pathname &symlink_r, Pathname &target_r)
| Like '::readlink'.
Pathname | expandlink (const Pathname &path_r) ZYPP_API
| Recursively follows the symlink pointed to by path_r and returns the Pathname to the real file or directory pointed to by the link.
int | copy_file2dir (const Pathname &file, const Pathname &dest)
| Like 'cp file dest'.
int | assert_file (const Pathname &path, unsigned mode=0644) ZYPP_API
| Create an empty file if it does not yet exist.
int | assert_file_mode (const Pathname &path, unsigned mode=0644) ZYPP_API
| Like assert_file but enforce mode even if the file already exists.
int | touch (const Pathname &path) ZYPP_API
| Change file's modification and access times.
Pathname | readlink (const Pathname &symlink_r)
Digest computaion.
Todo check cooperation with zypp::Digest
std::string | md5sum (const Pathname &file)
| Compute a files md5sum.
std::string | sha1sum (const Pathname &file)
| Compute a files sha1sum.
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
Changing permissions.
int | chmod (const Pathname &path, mode_t mode)
| Like '::chmod'.
int | chmodApplyUmask (const Pathname &path, mode_t mode)
| Similar to '::chmod', but `mode` is modified by the process's umask in the usual way.
int | addmod (const Pathname &path, mode_t mode)
| Add the `mode` bits to the file given by path.
int | delmod (const Pathname &path, mode_t mode)
| Remove the `mode` bits from the file given by path.

## Variables
template<class... T>
constexpr bool | always_false = false

## Misc.
enum | ZIP_TYPE { ZT_NONE , ZT_GZ , ZT_BZ2 , ZT_ZCHNK }
| 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.
using | DirContent = std::list<DirEntry>
| Returned by readdir.
bool | userMayWriteOrCreateDir (const Pathname &path_r)
| Returns whether path_r denotes an existing directory with write permission for the current user or an existing parent directory has write permission for the current user so the directory can be created by him.
int | mkdir (const Pathname &path, unsigned mode=0755) ZYPP_API
| Like '::mkdir'.
int | assert_dir (const Pathname &path, unsigned mode=0755) ZYPP_API
| Like 'mkdir -p'.
int | rmdir (const Pathname &path) ZYPP_API
| Like '::rmdir'.
int | recursive_rmdir (const Pathname &path) ZYPP_API
| Like 'rm -r DIR'.
int | clean_dir (const Pathname &path) ZYPP_API
| Like 'rm -r DIR/ *'.
int | copy_dir (const Pathname &srcpath, const Pathname &destpath) ZYPP_API
| Like 'cp -a srcpath destpath'.
int | copy_dir_content (const Pathname &srcpath, const Pathname &destpath) ZYPP_API
| Like 'cp -a srcpath/.
int | dirForEach (const Pathname &dir_r, const function< bool(const Pathname &, const char *const)> &fnc_r) ZYPP_API
| Invoke callback function fnc_r for each entry in directory dir_r.
int | dirForEachExt (const Pathname &dir_r, const function< bool(const Pathname &, const DirEntry &)> &fnc_r) ZYPP_API
| Simiar to.
int | readdir (std::list< std::string > &retlist, const Pathname &path, bool dots=true) ZYPP_API
| Return content of directory via retlist.
int | readdir (std::list< Pathname > &retlist, const Pathname &path, bool dots=true) ZYPP_API
| Return content of directory via retlist.
int | readdir (DirContent &retlist, const Pathname &path, bool dots=true, PathInfo::Mode statmode=PathInfo::STAT) ZYPP_API
| Return content of directory via retlist.
std::ostream & | operator<< (std::ostream &str, const DirContent &obj)
int | is_empty_dir (const Pathname &path) ZYPP_API
| Check if the specified directory is empty.
std::ostream & | operator<< (std::ostream &str, const DirEntry &obj)

## Detailed Description

Types and functions for filesystem operations.

Todo

  move zypp::filesystem stuff into separate header

  Add tmpfile and tmpdir handling.

  think about using Exceptions in zypp::filesystem

  provide a readdir iterator; at least provide an interface using an insert_iterator to be independent from std::container.

Todo

  move zypp::filesystem stuff into separate header

  Add tmpfile and tmpdir handling.

  think about using Exceptions in zypp::filesystem

  provide a readdir iterator; at least provide an interface using an insert_iterator to be independent from std::container.

## Typedef Documentation

## ◆ DirContent

using zypp::filesystem::DirContent = std::list<DirEntry>

Returned by readdir.

Definition at line 534 of file PathInfo.h.

## Enumeration Type Documentation

## ◆ FileType

enum zypp::filesystem::FileType

File type information.

Todo
  Think about an Enumeration Class

Enumerator
FT_NOT_AVAIL |
FT_NOT_EXIST |
FT_FILE |
FT_DIR |
FT_CHARDEV |
FT_BLOCKDEV |
FT_FIFO |
FT_LINK |
FT_SOCKET |

Definition at line 59 of file PathInfo.h.

## ◆ ZIP_TYPE

enum zypp::filesystem::ZIP_TYPE

Test whether a file is compressed (gzip/bzip2).

Returns
  ZT_GZ, ZT_BZ2 if file is compressed, otherwise ZT_NONE.

Enumerator
ZT_NONE |
ZT_GZ |
ZT_BZ2 |
ZT_ZCHNK |

Definition at line 778 of file PathInfo.h.

## Function Documentation

## ◆ operator<<() [1/9]

std::ostream & zypp::filesystem::operator<< | ( | std::ostream & | str,
|  | const Glob & | obj )

relates: Glob Stream output

Definition at line 53 of file Glob.cc.

## ◆ operator<<() [2/9]

std::ostream & zypp::filesystem::operator<< | ( | std::ostream & | str,
|  | const Glob::const_iterator & | obj )
| inline

relates: Glob::const_iterator Stream output

Definition at line 258 of file Glob.h.

## ◆ ZYPP_DECLARE_OPERATORS_FOR_FLAGS()

zypp::filesystem::ZYPP_DECLARE_OPERATORS_FOR_FLAGS | ( | Glob::Flags |  | ) |

## ◆ matchNoDots()

const StrMatcher & zypp::filesystem::matchNoDots | ( |  | ) |

Convenience returning StrMatcher( "[^.]*", Match::GLOB ).

See also
  dirForEach

Definition at line 26 of file PathInfo.cc.

## ◆ dirForEach() [1/2]

int zypp::filesystem::dirForEach | ( | const Pathname & | dir_r,
|  | const StrMatcher & | matcher_r,
|  | function< bool(const Pathname &, const char *const)> | fnc_r )

Definition at line 32 of file PathInfo.cc.

## ◆ operator<<() [3/9]

std::ostream & zypp::filesystem::operator<< | ( | std::ostream & | str,
|  | FileType | obj )

relates: FileType Stram output.

Definition at line 48 of file PathInfo.cc.

## ◆ operator<<() [4/9]

std::ostream & zypp::filesystem::operator<< | ( | std::ostream & | str,
|  | const StatMode & | obj )

relates: StatMode Stream output.

Definition at line 96 of file PathInfo.cc.

## ◆ operator<<() [5/9]

std::ostream & zypp::filesystem::operator<< | ( | std::ostream & | str,
|  | const PathInfo & | obj )

relates: PathInfo Stream output.

Definition at line 262 of file PathInfo.cc.

## ◆ userMayWriteOrCreateDir()

bool zypp::filesystem::userMayWriteOrCreateDir | ( | const Pathname & | path_r | ) |

Returns whether path_r denotes an existing directory with write permission for the current user or an existing parent directory has write permission for the current user so the directory can be created by him.

Definition at line 306 of file PathInfo.cc.

## ◆ mkdir()

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.

Returns
  0 on success, errno on failure

Definition at line 324 of file PathInfo.cc.

## ◆ assert_dir()

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.

Returns
  0 on success, errno on failure

Definition at line 338 of file PathInfo.cc.

## ◆ rmdir()

int zypp::filesystem::rmdir | ( | const Pathname & | path | ) |

Like '::rmdir'.

Delete a directory, which must be empty.

Returns
  0 on success, errno on failure

Definition at line 385 of file PathInfo.cc.

## ◆ recursive_rmdir_1()

int zypp::filesystem::recursive_rmdir_1 | ( | const Pathname & | dir,
|  | bool | removeDir = true )
| static

Definition at line 399 of file PathInfo.cc.

## ◆ recursive_rmdir()

int zypp::filesystem::recursive_rmdir | ( | const Pathname & | path | ) |

Like 'rm -r DIR'.

Delete a directory, recursively removing its contents.

Returns
  0 on success, ENOTDIR if path is not a directory, otherwise the commands return value.

Definition at line 431 of file PathInfo.cc.

## ◆ clean_dir()

int zypp::filesystem::clean_dir | ( | const Pathname & | path | ) |

Like 'rm -r DIR/ *'.

Delete directory contents, but keep the directory itself.

Returns
  0 on success, ENOTDIR if path is not a directory, otherwise the commands return value.

Definition at line 461 of file PathInfo.cc.

## ◆ copy_dir()

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.

Returns
  0 on success, ENOTDIR if srcpath/destpath is not a directory, EEXIST if 'basename srcpath' exists in destpath, otherwise the commands return value.

Definition at line 482 of file PathInfo.cc.

## ◆ copy_dir_content()

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.

Returns
  0 on success, ENOTDIR if srcpath/destpath is not a directory, EEXIST if srcpath and destpath are equal, otherwise the commands return value.

Definition at line 523 of file PathInfo.cc.

## ◆ dirForEachImpl()

template<typename F>

int zypp::filesystem::dirForEachImpl | ( | const Pathname & | dir_r,
|  | F && | fnc_r )

Definition at line 566 of file PathInfo.cc.

## ◆ dirForEach() [2/2]

int zypp::filesystem::dirForEach | ( | const Pathname & | dir_r,
|  | const function< bool(const Pathname &, const char *const)> & | fnc_r )

Invoke callback function fnc_r for each entry in directory dir_r.

If fnc_r is a `NULL` function `0` is returned immediately without even testing or accessing dir_r.

Otherwise `::readdir` is used to read the name of every entry in dir_r, omitting `'`.' and `'`..'. dir_r and the current entries name are passed as arguments to fnc_r. If fnc_r returns `false` processing is aborted.

Returns
  0 on success, -1 if aborted by callback, errno > 0 on ::readdir failure.

Definition at line 603 of file PathInfo.cc.

## ◆ dirForEachExt()

int zypp::filesystem::dirForEachExt | ( | const Pathname & | dir_r,
|  | const function< bool(const Pathname &, const DirEntry &)> & | fnc_r )

Simiar to.

See also
  dirForEach, except that the callback takes a
  DirEntry as second argument

Definition at line 612 of file PathInfo.cc.

## ◆ readdir() [1/3]

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.

Returns
  0 on success, errno on failure.

Todo
  provide some readdirIterator.

Definition at line 624 of file PathInfo.cc.

## ◆ readdir() [2/3]

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.

Returns
  0 on success, errno on failure.

Todo
  provide some readdirIterator.

Definition at line 637 of file PathInfo.cc.

## ◆ readdir() [3/3]

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).

Returns
  0 on success, errno on failure.

Definition at line 688 of file PathInfo.cc.

## ◆ operator<<() [6/9]

std::ostream & zypp::filesystem::operator<< | ( | std::ostream & | str,
|  | const DirContent & | obj )

Definition at line 700 of file PathInfo.cc.

## ◆ is_empty_dir()

int zypp::filesystem::is_empty_dir | ( | const Pathname & | path | ) |

Check if the specified directory is empty.

Parameters

  path | The path of the directory to check.

Returns
  0 if directory is empty, -1 if not, errno > 0 on failure.

Definition at line 707 of file PathInfo.cc.

## ◆ unlink()

int zypp::filesystem::unlink | ( | const Pathname & | path | ) |

Like '::unlink'.

Delete a file (symbolic link, socket, fifo or device).

Returns
  0 on success, errno on failure

Definition at line 719 of file PathInfo.cc.

## ◆ rename()

int zypp::filesystem::rename | ( | const Pathname & | oldpath,
|  | const Pathname & | newpath )

Like '::rename'.

Renames a file, moving it between directories if required. It falls back to using mv(1) in case errno is set to EXDEV, indicating a cross-device rename, which is likely to happen when oldpath and newpath are not on the same OverlayFS layer.

Returns
  0 on success, errno on failure

Definition at line 761 of file PathInfo.cc.

## ◆ exchange()

int zypp::filesystem::exchange | ( | const Pathname & | lpath,
|  | const Pathname & | rpath )

Exchanges two files or directories.

Most common use is when building a new config file (or dir) in a tempfile. After the job is done, configfile and tempfile are exchanged. This includes moving away the configfile in case the tempfile does not exist. Parent directories are created as needed.

Note
  Paths are exchanged using `::rename`, so take care both paths are located on the same filesystem.

Pathname configfile( "/etc/myconfig" );
TmpFile newconfig( TmpFile::makeSibling( configfile ) );
// now write the new config:
std::ofstream o( newconfig.path().c_str() );
o << "mew values << endl;
o.close();
// If everything is fine, exchange the files:
exchange( newconfig.path(), configfile );
// Now the old configfile is still available at newconfig.path()
// until newconfig goes out of scope.
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::filesystem::TmpFile
Provide a new empty temporary file and delete it when no longer needed.
Definition TmpPath.h:118
zypp::filesystem::TmpFile::makeSibling
static TmpFile makeSibling(const Pathname &sibling_r)
Provide a new empty temporary directory as sibling.
Definition TmpPath.cc:182

Returns
  0 on success, errno on failure

Definition at line 775 of file PathInfo.cc.

## ◆ copy()

int zypp::filesystem::copy | ( | const Pathname & | file,
|  | const Pathname & | dest )

Like 'cp file dest'.

Copy file to destination file.

Returns
  0 on success, EINVAL if file is not a file, EISDIR if destiantion is a directory, otherwise the commands return value.

Definition at line 839 of file PathInfo.cc.

## ◆ symlink()

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.

Returns
  0 on success, errno on failure.

Definition at line 874 of file PathInfo.cc.

## ◆ hardlink()

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.

Returns
  0 on success, errno on failure.

Definition at line 888 of file PathInfo.cc.

## ◆ hardlinkCopy()

int zypp::filesystem::hardlinkCopy | ( | const Pathname & | oldpath,
|  | const Pathname & | newpath )

Create newpath as hardlink or copy of oldpath.

Returns
  0 on success, errno on failure.

Definition at line 902 of file PathInfo.cc.

## ◆ readlink() [1/2]

int zypp::filesystem::readlink | ( | const Pathname & | symlink_r,
|  | Pathname & | target_r )

Like '::readlink'.

Return the contents of the symbolic link symlink_r via target_r.

Returns
  0 on success, errno on failure.

Definition at line 943 of file PathInfo.cc.

## ◆ expandlink()

Pathname zypp::filesystem::expandlink | ( | const Pathname & | path_r | ) |

Recursively follows the symlink pointed to by path_r and returns the Pathname to the real file or directory pointed to by the link.

There is a recursion limit of 256 iterations to protect against a cyclic link.

Returns
  Pathname of the file or directory pointed to by the given link if it is a valid link. If path_r is not a link, an exact copy of it is returned. If path_r is a broken or a cyclic link, an empty Pathname is returned and the event logged.

Definition at line 964 of file PathInfo.cc.

## ◆ copy_file2dir()

int zypp::filesystem::copy_file2dir | ( | const Pathname & | file,
|  | const Pathname & | dest )

Like 'cp file dest'.

Copy file to dest dir.

Returns
  0 on success, EINVAL if file is not a file, ENOTDIR if dest is no directory, otherwise the commands return value.

Definition at line 1009 of file PathInfo.cc.

## ◆ md5sum()

std::string zypp::filesystem::md5sum | ( | const Pathname & | file | ) |

Compute a files md5sum.

Returns
  the files md5sum on success, otherwise an empty string..

Definition at line 1043 of file PathInfo.cc.

## ◆ sha1sum()

std::string zypp::filesystem::sha1sum | ( | const Pathname & | file | ) |

Compute a files sha1sum.

Returns
  the files sha1sum on success, otherwise an empty string..

Definition at line 1060 of file PathInfo.cc.

## ◆ checksum()

std::string zypp::filesystem::checksum | ( | const Pathname & | file,
|  | const std::string & | algorithm )

Compute a files checksum.

Returns
  the files checksum on success, otherwise an empty string..

Definition at line 1070 of file PathInfo.cc.

## ◆ is_checksum()

bool zypp::filesystem::is_checksum | ( | const Pathname & | file,
|  | const CheckSum & | checksum )

check files checksum

Returns
  true if the checksum matches (an empty Checksum always matches!)

Definition at line 1082 of file PathInfo.cc.

## ◆ erase()

int zypp::filesystem::erase | ( | const Pathname & | path | ) |

Erase whatever happens to be located at path (file or directory).

Returns
  0 on success.

Todo
  check cooperation with zypp::TmpFile and zypp::TmpDir

Definition at line 1092 of file PathInfo.cc.

## ◆ chmod()

int zypp::filesystem::chmod | ( | const Pathname & | path,
|  | mode_t | mode )

Like '::chmod'.

The mode of the file given by path is changed.

Returns
  0 on success, errno on failure

Definition at line 1111 of file PathInfo.cc.

## ◆ chmodApplyUmask()

int zypp::filesystem::chmodApplyUmask | ( | const Pathname & | path,
|  | mode_t | mode )

Similar to '::chmod', but `mode` is modified by the process's umask in the usual way.

Returns
  0 on success, errno on failure

Definition at line 1120 of file PathInfo.cc.

## ◆ addmod()

int zypp::filesystem::addmod | ( | const Pathname & | path,
|  | mode_t | mode )

Add the `mode` bits to the file given by path.

Returns
  0 on success, errno on failure

Definition at line 1123 of file PathInfo.cc.

## ◆ delmod()

int zypp::filesystem::delmod | ( | const Pathname & | path,
|  | mode_t | mode )

Remove the `mode` bits from the file given by path.

Returns
  0 on success, errno on failure

Definition at line 1132 of file PathInfo.cc.

## ◆ zipType()

ZIP_TYPE zypp::filesystem::zipType | ( | const Pathname & | file | ) |

Definition at line 1146 of file PathInfo.cc.

## ◆ df()

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.

Returns
  Free disk space or -1 on error.

Definition at line 1177 of file PathInfo.cc.

## ◆ getUmask()

mode_t zypp::filesystem::getUmask | ( |  | ) |

Get the current umask (file mode creation mask).

Returns
  The current umask

Definition at line 1193 of file PathInfo.cc.

## ◆ assert_file()

int zypp::filesystem::assert_file | ( | const Pathname & | path,
|  | unsigned | mode = 0644 )

Create an empty file if it does not yet exist.

Make parent directories as needed. mode specifies the permissions to use. It is modified by the process's umask in the usual way.

Returns
  0 on success, errno on failure

Definition at line 1205 of file PathInfo.cc.

## ◆ assert_file_mode()

int zypp::filesystem::assert_file_mode | ( | const Pathname & | path,
|  | unsigned | mode )

Like assert_file but enforce mode even if the file already exists.

Definition at line 1224 of file PathInfo.cc.

## ◆ touch()

int zypp::filesystem::touch | ( | const Pathname & | path | ) |

Change file's modification and access times.

Returns
  0 on success, errno on failure

See also
  man utime

Definition at line 1256 of file PathInfo.cc.

## ◆ operator<<() [7/9]

std::ostream & zypp::filesystem::operator<< | ( | std::ostream & | str,
|  | const DirEntry & | obj )
| inline

Definition at line 530 of file PathInfo.h.

## ◆ readlink() [2/2]

Pathname zypp::filesystem::readlink | ( | const Pathname & | symlink_r | ) |
| inline

Definition at line 673 of file PathInfo.h.

## ◆ applyUmaskTo()

mode_t zypp::filesystem::applyUmaskTo | ( | mode_t | mode_r | ) |
| inline

Modify `mode_r` according to the current umask ( mode_r & ~getUmask() ).

See also
  getUmask.

Returns
  The resulting permissions.

Definition at line 813 of file PathInfo.h.

## ◆ operator<<() [8/9]

std::ostream & zypp::filesystem::operator<< | ( | std::ostream & | str,
|  | const TmpPath & | obj )
| inline

relates: TmpPath Stream output as pathname.

Definition at line 100 of file TmpPath.h.

## ◆ operator==()

bool zypp::filesystem::operator== | ( | const Pathname & | l,
|  | const Pathname & | r )
| inline

relates: Pathname

Definition at line 202 of file Pathname.h.

## ◆ operator!=()

bool zypp::filesystem::operator!= | ( | const Pathname & | l,
|  | const Pathname & | r )
| inline

relates: Pathname

Definition at line 206 of file Pathname.h.

## ◆ operator/()

Pathname zypp::filesystem::operator/ | ( | const Pathname & | l,
|  | const Pathname & | r )
| inline

relates: Pathname Concatenate two Pathname.

Definition at line 210 of file Pathname.h.

## ◆ operator+()

Pathname zypp::filesystem::operator+ | ( | const Pathname & | l,
|  | const Pathname & | r )
| inline

relates: Pathname Concatenate two Pathname.

Deprecated
  : use /

Definition at line 216 of file Pathname.h.

## ◆ operator<()

bool zypp::filesystem::operator< | ( | const Pathname & | l,
|  | const Pathname & | r )
| inline

relates: Pathname

Definition at line 220 of file Pathname.h.

## ◆ operator<<() [9/9]

std::ostream & zypp::filesystem::operator<< | ( | std::ostream & | str,
|  | const Pathname & | obj )
| inline

relates: Pathname Stream output

Definition at line 226 of file Pathname.h.

## Variable Documentation

## ◆ always_false

template<class... T>

bool zypp::filesystem::always_false = false
| constexpr

Definition at line 563 of file PathInfo.cc.