Cleanup and support for relative paths
This commit is contained in:
1 parent
389113722e
commit
c17fbd2dcf
11 files changed
+339
-73
No files matched your search
@@ -1016,8 +1016,7 @@ PResult<ValueNode> ComdelParser::parseValue() {
|
||||
return unexpected();
|
||||
}
|
||||
|
||||
//return spanner(value);
|
||||
return value;
|
||||
return spanner(value);
|
||||
}
|
||||
|
||||
std::optional<SchemaNode> ComdelParser::parseSchema() {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <QDir>
|
||||
|
||||
std::optional<LibraryNode> loadLibraryFromFile(ParseContext * parseContext,
|
||||
const char* name,
|
||||
@@ -75,7 +76,17 @@ std::optional<SchemaNode> loadSchemaFromFile(ParseContext * parseContext,
|
||||
}
|
||||
|
||||
if(unit->source) {
|
||||
unit->library = loadLibraryFromFile(parseContext, unit->source->asString().c_str(), stream);
|
||||
QFileInfo info(name);
|
||||
auto filepath = info.absolutePath();
|
||||
QDir dir;
|
||||
dir.setCurrent(filepath);
|
||||
|
||||
auto libraryPath = dir.absoluteFilePath(QString::fromStdString(unit->source->asString()));
|
||||
|
||||
unit->library = loadLibraryFromFile(parseContext, libraryPath.toUtf8().data(), stream);
|
||||
if(unit->library == std::nullopt) {
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user