summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lexer.l8
-rw-r--r--src/parsersettings.cc13
-rw-r--r--src/parsersettings.h3
3 files changed, 19 insertions, 5 deletions
diff --git a/src/lexer.l b/src/lexer.l
index 7f6586a..4e51e14 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -110,13 +110,13 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); }
">" {
BEGIN(INITIAL);
fs::path usepath;
- if ( boosty::is_absolute( fs::path(filename) ) ) {
+ if (boosty::is_absolute(fs::path(filename))) {
usepath = filename;
}
else {
usepath = fs::path(parser_source_path) / filename;
if (!fs::exists(usepath)) {
- usepath = boosty::absolute(fs::path(librarydir) / filename);
+ usepath = boosty::absolute(fs::path(get_librarydir()) / filename);
}
}
handle_dep(usepath.string());
@@ -199,7 +199,7 @@ void includefile()
fs::path dirinfo = sourcepath();
if (!filepath.empty()) {
- if (boosty::is_absolute( fs::path(filepath) ) ) {
+ if (boosty::is_absolute(fs::path(filepath))) {
dirinfo = filepath;
}
else {
@@ -209,7 +209,7 @@ void includefile()
fs::path finfo = dirinfo / filename;
if (!exists(finfo)) {
- finfo = fs::path(librarydir) / filepath / filename;
+ finfo = fs::path(get_librarydir()) / filepath / filename;
}
filepath.clear();
diff --git a/src/parsersettings.cc b/src/parsersettings.cc
index 330e2e2..a3a02b7 100644
--- a/src/parsersettings.cc
+++ b/src/parsersettings.cc
@@ -1,13 +1,25 @@
#include "parsersettings.h"
#include <boost/filesystem.hpp>
+#include <qglobal.h> // Needed for Q_ defines - move the offending code somewhere else
using namespace boost::filesystem;
#include "boosty.h"
std::string librarydir;
+void set_librarydir(const std::string &libdir)
+{
+ librarydir = libdir;
+}
+
+const std::string &get_librarydir()
+{
+ return librarydir;
+}
+
void parser_init(const std::string &applicationpath)
{
+ std::string librarydir;
path libdir(applicationpath);
path tmpdir;
#ifdef Q_WS_MAC
@@ -25,4 +37,5 @@ void parser_init(const std::string &applicationpath)
if (is_directory(tmpdir = libdir / "libraries")) {
librarydir = boosty::stringy( tmpdir );
}
+ set_librarydir(librarydir);
}
diff --git a/src/parsersettings.h b/src/parsersettings.h
index 61dcf99..a5dc939 100644
--- a/src/parsersettings.h
+++ b/src/parsersettings.h
@@ -3,9 +3,10 @@
#include <string>
-extern std::string librarydir;
extern int parser_error_pos;
void parser_init(const std::string &applicationpath);
+void set_librarydir(const std::string &libdir);
+const std::string &get_librarydir();
#endif
contact: Jan Huwald // Impressum