SlHelpers
Loading...
Searching...
No Matches
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.
 PushD (const std::filesystem::path &dir)
 Change to directory dir and throw an exception on error.

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:
  • /home/abuild/rpmbuild/BUILD/slhelpers-20260428.f233ce9-build/slhelpers-20260428.f233ce9/include/helpers/PushD.h