zz::fs::Path Class Reference

The Path class to resolve filesystem path. More...

#include <zupply.hpp>

Public Member Functions

 Path (std::string path, bool isAbsolute=false)
 
bool empty () const
 Check if path is empty. More...
 
bool exist () const
 Check path existance, whatever file/dir/device... More...
 
bool is_file () const
 Check if path is a file and exist. More...
 
bool is_dir () const
 Check if path is a directory and exist. More...
 
std::string abs_path () const
 Return Absolute path. More...
 
std::string relative_path () const
 Return relative path to current working directory. More...
 
std::string relative_path (std::string root) const
 Return relative path to specified root. More...
 
std::string filename () const
 Return filename if is file and exist. Will return empty string if path is not a file. More...
 

Detailed Description

The Path class to resolve filesystem path.

Member Function Documentation

std::string zz::fs::Path::abs_path ( ) const

Return Absolute path.

Returns
A std::string of absolute path
bool zz::fs::Path::empty ( ) const

Check if path is empty.

Returns
True if empty
bool zz::fs::Path::exist ( ) const

Check path existance, whatever file/dir/device...

Returns
True if path exist
std::string zz::fs::Path::filename ( ) const

Return filename if is file and exist. Will return empty string if path is not a file.

Returns
A std::string of filename
bool zz::fs::Path::is_dir ( ) const

Check if path is a directory and exist.

Returns
True if dir exist
bool zz::fs::Path::is_file ( ) const

Check if path is a file and exist.

Returns
True if file exist
std::string zz::fs::Path::relative_path ( ) const

Return relative path to current working directory.

Returns
A std::string of relative path to cwd
std::string zz::fs::Path::relative_path ( std::string  root) const

Return relative path to specified root.

Parameters
rootSpecified root path
Returns
A std::string of relative path to root

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