summaryrefslogtreecommitdiff
path: root/src/context.cc
diff options
context:
space:
mode:
authorkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-02-23 20:47:54 (GMT)
committerkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-02-23 20:47:54 (GMT)
commitf3d16e23b959be4eb05c50e09a880b1e642f3432 (patch)
tree9e27ce8f230fa3c8645c363a3823d82649839261 /src/context.cc
parent64c3be3fd7734f94f1057825ad66ba4ac2393134 (diff)
Multiple non-MDI assumptions were made, setting CWD and assuming it didn't change. Fix required to pass more context to nodes (functions). It's not totally clean, but it's a start. Fixes bugs: opening multiple files simultaneously only loaded the first file, refreshing an scad file referencing an external file failed if another scad file was opened in the meantime.
git-svn-id: http://svn.clifford.at/openscad/trunk@451 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src/context.cc')
-rw-r--r--src/context.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/context.cc b/src/context.cc
index 8c84374..a9ccc98 100644
--- a/src/context.cc
+++ b/src/context.cc
@@ -28,6 +28,8 @@
#include "function.h"
#include "module.h"
#include "printutils.h"
+#include <QFileInfo>
+#include <QDir>
Context::Context(const Context *parent)
{
@@ -35,6 +37,7 @@ Context::Context(const Context *parent)
functions_p = NULL;
modules_p = NULL;
inst_p = NULL;
+ if (parent) document_path = parent->document_path;
ctx_stack.append(this);
}
@@ -109,3 +112,8 @@ AbstractNode *Context::evaluate_module(const ModuleInstantiation *inst) const
return NULL;
}
+QString Context::get_absolute_path(const QString &filename) const
+{
+ return QFileInfo(QDir(this->document_path), filename).absoluteFilePath();
+}
+
contact: Jan Huwald // Impressum