Keep mCWD as an absolute path.

This commit is contained in:
Steve Checkoway
2003-09-10 03:26:12 +00:00
parent 04c7707c16
commit 010f353817
2 changed files with 13 additions and 3 deletions
@@ -12,6 +12,7 @@ using namespace std;
#include <vector> #include <vector>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/param.h>
#include "StdString.h" #include "StdString.h"
#include "Processor.h" #include "Processor.h"
@@ -42,6 +43,17 @@ CString StripVar(const CString& var)
return var.substr(1, var.npos); return var.substr(1, var.npos);
} }
Processor::Processor(CString& path, handleFileFunc f, getPathFunc p, askFunc a, bool i)
: mDoGoto(false), mPath(path), mHandleFile(f), mGetPath(p), mAsk(a),
mError(Processor::DefaultError), mInstalling(i)
{
char cwd[MAXPATHLEN];
getwd(cwd);
mCWD = cwd;
mConditionals["INSTALLING"] = i;
}
void Processor::ProcessLine(const CString& line, unsigned& nextLine) void Processor::ProcessLine(const CString& line, unsigned& nextLine)
{ {
CStringArray parts; CStringArray parts;
+1 -3
View File
@@ -42,9 +42,7 @@ private:
bool ResolveConditional(const CString& cond); bool ResolveConditional(const CString& cond);
static void DefaultError(const char *fmt, ...); static void DefaultError(const char *fmt, ...);
public: public:
Processor(CString& path, handleFileFunc f, getPathFunc p, askFunc a, bool i) Processor(CString& path, handleFileFunc f, getPathFunc p, askFunc a, bool i);
: mDoGoto(false), mPath(path), mCWD("."), mHandleFile(f), mGetPath(p), mAsk(a),
mError(Processor::DefaultError), mInstalling(i) { mConditionals["INSTALLING"] = i; }
void ProcessLine(const CString& line, unsigned& nextLine); void ProcessLine(const CString& line, unsigned& nextLine);
void SetErrorFunc(errorFunc f) { mError = f; } void SetErrorFunc(errorFunc f) { mError = f; }
}; };