| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csVfsDirectoryChanger Class Reference

Helper class to change the current VFS directory and restore the previous directory when an instance goes out of scope. More...

`#include <cstool/vfsdirchange.h>`

List of all members.

## Public Member Functions
void | ChangeTo (const char *filename)
| Change to the directory filename is in.
| csVfsDirectoryChanger (iVFS *vfs)
| Create instance.
void | PushDir ()
| Just pushes the current directory, but doesn't change it in anyway - useful when you want to call ChDir() or ChDirAuto() manually for some reason, but still want to have the current directory restored automatically.
| ~csVfsDirectoryChanger ()
| Destroy instance. Restores the old directory if ChangeTo() was called.

## Detailed Description

Helper class to change the current VFS directory and restore the previous directory when an instance goes out of scope.

Definition at line 31 of file vfsdirchange.h.

## Constructor & Destructor Documentation

csVfsDirectoryChanger::csVfsDirectoryChanger | ( | iVFS * | vfs | ) | `[inline]`

Create instance.

Definition at line 41 of file vfsdirchange.h.

csVfsDirectoryChanger::~csVfsDirectoryChanger | ( |  | ) | `[inline]`

Destroy instance. Restores the old directory if ChangeTo() was called.

Definition at line 43 of file vfsdirchange.h.

## Member Function Documentation

void csVfsDirectoryChanger::ChangeTo | ( | const char * | filename | ) | `[inline]`

Change to the directory filename is in.

Remarks:
  Only the part of the path up to the last '/' is treated as the directory to change to. E.g. both "<tt>/foo/bar/baz</tt>" and "<tt>/foo/bar/</tt>" will cause a directory change to "<tt>/foo/bar</tt>".

Definition at line 53 of file vfsdirchange.h.

References csStringBase::Replace().

void csVfsDirectoryChanger::PushDir | ( |  | ) | `[inline]`

Just pushes the current directory, but doesn't change it in anyway - useful when you want to call ChDir() or ChDirAuto() manually for some reason, but still want to have the current directory restored automatically.

Definition at line 72 of file vfsdirchange.h.

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

- cstool/vfsdirchange.h