SlHelpers
SlHelpers::PushD Class Reference

Change to a directory while this object lives, then change back. More...

#include <PushD.h>

Public Member Functions

 PushD (const std::filesystem::path &dir, std::error_code &ec)
 Change to directory dir. More...
 
 PushD (const std::filesystem::path &dir)
 Change to directory dir and throw an exception on error. More...
 

Detailed Description

Change to a directory while this object lives, then change back.

Constructor & Destructor Documentation

◆ PushD() [1/2]

SlHelpers::PushD::PushD ( const std::filesystem::path &  dir,
std::error_code &  ec 
)
inline

Change to directory dir.

Parameters
dirDirectory to cd to
ecError code if something failed

When the destructor is called, it is cd-ed back to the original directory (the current directory before the call to constructor).

◆ PushD() [2/2]

SlHelpers::PushD::PushD ( const std::filesystem::path &  dir)
inline

Change to directory dir and throw an exception on error.

Parameters
dirDirectory to cd to

When the destructor is called, it is cd-ed back to the original directory (the current directory before the call to constructor).


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