Skip to content

Commit

Permalink
Fix for issue #97
Browse files Browse the repository at this point in the history
  • Loading branch information
CerielJacobs committed Aug 29, 2022
1 parent 94ab253 commit c78c8b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/vlog/common/edb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,17 @@ void EDBLayer::addInmemoryTable(const EDBConf::Table &tableConf) {
infot.id = (PredId_t) predDictionary->getOrAdd(pn);
infot.type = tableConf.type;
string repository = tableConf.params[0];
#if defined(_WIN32)
if (repository.size() <= 1 || repository[1] != ':') {
//Relative path. Add the root path
repository = rootPath + DIR_SEP + repository;
}
#else
if (repository.size() > 0 && repository[0] != '/') {
//Relative path. Add the root path
repository = rootPath + "/" + repository;
}
#endif
InmemoryTable *table;
if (tableConf.params.size() == 2) {
table = new InmemoryTable(repository,
Expand Down
6 changes: 3 additions & 3 deletions src/vlog/inmemory/inmemorytable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ InmemoryTable::InmemoryTable(std::string repository, std::string tablename,
if (repository == "") {
repository = ".";
}
std::string tablefile = repository + "/" + tablename + ".csv";
std::string tablefile = repository + DIR_SEP + tablename + ".csv";
std::string gz = tablefile + ".gz";
istream *ifs = NULL;
if (Utils::exists(gz)) {
Expand Down Expand Up @@ -143,7 +143,7 @@ InmemoryTable::InmemoryTable(std::string repository, std::string tablename,
}
delete ifs;
} else {
tablefile = repository + "/" + tablename + ".nt";
tablefile = repository + DIR_SEP + tablename + ".nt";
std::string gz = tablefile + ".gz";
FileInfo f;
f.start = 0;
Expand All @@ -156,7 +156,7 @@ InmemoryTable::InmemoryTable(std::string repository, std::string tablename,
f.path = tablefile;
f.splittable = true;
} else {
std::string e = "While importing data for predicate \"" + layer->getPredName(predid) + "\": could not open file " + tablefile + " nor " + (repository + "/" + tablename + ".csv") + " nor gzipped versions";
std::string e = "While importing data for predicate \"" + layer->getPredName(predid) + "\": could not open file " + tablefile + " nor " + (repository + DIR_SEP + tablename + ".csv") + " nor gzipped versions";
LOG(ERRORL) << e;
segment = NULL;
throw(e);
Expand Down
3 changes: 3 additions & 0 deletions src/vlog/java/native/VLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ extern "C" {
f = new VLogInfo();
try {
EDBConf conf(crawconf.c_str(), isfile);
if (isfile) {
conf.setRootPath(Utils::parentDir(crawconf));
}

try {
f->layer = new EDBLayer(conf, false);
Expand Down

0 comments on commit c78c8b0

Please sign in to comment.