It is accomplished ...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include <TestCase.h>
|
||||
#include <unistd.h>
|
||||
|
||||
TestCase::TestCase()
|
||||
: CppUnit::TestCase()
|
||||
, fValidCWD(false)
|
||||
{
|
||||
}
|
||||
|
||||
TestCase::TestCase(std::string name)
|
||||
: CppUnit::TestCase(name)
|
||||
, fValidCWD(false)
|
||||
{
|
||||
}
|
||||
|
||||
// Saves the location of the current working directory. To return to the
|
||||
// last saved working directory, all \ref RestorCWD().
|
||||
void
|
||||
TestCase::SaveCWD() {
|
||||
fValidCWD = getcwd(fCurrentWorkingDir, B_PATH_NAME_LENGTH);
|
||||
}
|
||||
|
||||
/* Restores the current working directory to last directory saved by a
|
||||
call to SaveCWD(). If SaveCWD() has not been called and an alternate
|
||||
directory is specified by alternate, the current working directory is
|
||||
changed to alternate. If alternate is null, the current working directory
|
||||
is not modified.
|
||||
*/
|
||||
void
|
||||
TestCase::RestoreCWD(const char *alternate) {
|
||||
if (fValidCWD)
|
||||
chdir(fCurrentWorkingDir);
|
||||
else if (alternate != NULL)
|
||||
chdir(alternate);
|
||||
}
|
||||
Reference in New Issue
Block a user