home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
Linux
/
Divers
/
lyx-0.13.2.tar.gz
/
lyx-0.13.2.tar
/
lyx-0.13.2
/
src
/
path.h
< prev
next >
Wrap
C/C++ Source or Header
|
1998-04-23
|
907b
|
60 lines
// -*- C++ -*-
#ifndef __PATH_H__
#define __PATH_H__
//#ifdef __GNUG__
//#pragma interface
//#endif
#include <unistd.h>
#include "LString.h"
#include "gettext.h"
#include "filetools.h"
#include "lyx_gui_misc.h"
class Path {
public:
///
Path(LString const & path)
: popped_(false)
{
if (!path.empty()) {
pushedDir_ = GetCWD();
if (pushedDir_.empty() || chdir(path.c_str())) {
WriteFSAlert(_("Error: Could not change to directory: "),
path);
}
} else {
popped_ = true;
}
}
///
~Path()
{
if (!popped_) pop();
}
///
int pop()
{
if (popped_) {
WriteFSAlert(_("Error: Dir already popped: "),
pushedDir_);
return 0;
}
if (chdir(pushedDir_.c_str())) {
WriteFSAlert(
_("Error: Could not change to directory: "),
pushedDir_);
}
popped_ = true;
return 0;
}
protected:
private:
bool popped_;
LString pushedDir_;
};
#endif