Keep mCWD as an absolute path.
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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; }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user