#include "Parser.h"
+#include "utility.h"
+
#include <auto_ptr.h>
#include <fstream>
namespace loader {
-Parser::Parser(const char *file, ParsedSource &product)
+Parser::Parser(const string &file, ParsedSource &product)
: file(file)
-, in(file)
+, dirname(Dirname(file))
+, in(this->file.c_str())
, tok(in)
, product(product) {
if (!in) {
void Parser::ParseIncludeDirective() {
Tokenizer::Token t(GetToken());
AssertTokenType(t.type, Tokenizer::Token::STRING);
- Parser sub(t.str.c_str(), product); // TODO: resolve path name
+ Parser sub(CatPath(dirname, t.str), product);
sub.Parse();
}