Nix  2.93.0-dev
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::CheckedSourcePath Class Reference

#include <source-path.hh>

Inheritance diagram for nix::CheckedSourcePath:
[legend]
Collaboration diagram for nix::CheckedSourcePath:
[legend]

Public Member Functions

std::string readFile () const
 
bool pathExists () const
 
InputAccessor::Stat lstat () const
 
std::optional< InputAccessor::StatmaybeLstat () const
 
InputAccessor::Stat stat () const
 
std::optional< InputAccessor::StatmaybeStat () const
 
InputAccessor::DirEntries readDirectory () const
 
std::string readLink () const
 
void dumpPath (Sink &sink, PathFilter &filter=defaultPathFilter) const
 
- Public Member Functions inherited from nix::SourcePath
 SourcePath (CanonPath path)
 
std::string_view baseName () const
 
SourcePath parent () const
 
const CanonPathcanonical () const
 
std::string to_string () const
 
CheckedSourcePath unsafeIntoChecked ()
 
SourcePath operator+ (const CanonPath &x) const
 
SourcePath operator+ (std::string_view c) const
 
bool operator== (const SourcePath &x) const
 
bool operator!= (const SourcePath &x) const
 
bool operator< (const SourcePath &x) const
 

Friends

struct SourcePath
 

Additional Inherited Members

- Protected Attributes inherited from nix::SourcePath
CanonPath path
 

Detailed Description

An abstraction for accessing source files during evaluation. Currently, it's just a wrapper around CanonPath that accesses files in the regular filesystem, but in the future it will support fetching files in other ways.

Member Function Documentation

◆ dumpPath()

void nix::CheckedSourcePath::dumpPath ( Sink & sink,
PathFilter & filter = defaultPathFilter ) const
inline

Dump this SourcePath to sink as a NAR archive.

◆ lstat()

InputAccessor::Stat nix::CheckedSourcePath::lstat ( ) const

Return stats about this SourcePath, or throw an exception if it doesn't exist.

◆ maybeLstat()

std::optional< InputAccessor::Stat > nix::CheckedSourcePath::maybeLstat ( ) const

Return stats about this SourcePath, or std::nullopt if it doesn't exist.

◆ maybeStat()

std::optional< InputAccessor::Stat > nix::CheckedSourcePath::maybeStat ( ) const

Return stats about this SourcePath, or std::nullopt if it doesn't exist. Symlinks are resolved by this function.

◆ pathExists()

bool nix::CheckedSourcePath::pathExists ( ) const
inline

Return whether this SourcePath denotes a file (of any type) that exists

◆ readDirectory()

InputAccessor::DirEntries nix::CheckedSourcePath::readDirectory ( ) const

If this SourcePath denotes a directory (not a symlink), return its directory entries; otherwise throw an error.

◆ readFile()

std::string nix::CheckedSourcePath::readFile ( ) const
inline

If this SourcePath denotes a regular file (not a symlink), return its contents; otherwise throw an error.

◆ readLink()

std::string nix::CheckedSourcePath::readLink ( ) const
inline

If this SourcePath denotes a symlink, return its target; otherwise throw an error.

◆ stat()

InputAccessor::Stat nix::CheckedSourcePath::stat ( ) const

Return stats about this SourcePath, or throw an exception if it doesn't exist. Symlinks are resolved by this function.


The documentation for this class was generated from the following files: