diff options
author | Marius Kintel <marius@kintel.net> | 2013-10-30 15:32:20 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-10-30 15:32:20 (GMT) |
commit | 3e79b547c10ca7070e609819e0c5f4888e82ab37 (patch) | |
tree | 7fb379b1fb2b5e342af8a366a92a4e91243f8a5c | |
parent | 8aa749f8b3bd0d6dd2cf4d2357a688319689432f (diff) | |
parent | a218869770c1b9f567e48c90867f9802463ad318 (diff) |
Merge pull request #521 from hzeller/fix-broken-absolute-path
Fix invocation with absolute path.
-rw-r--r-- | src/openscad.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/openscad.cc b/src/openscad.cc index 1e08a51..6bbaedb 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -450,6 +450,13 @@ int cmdline(const char *deps_output_file, const std::string &filename, Camera &c #include <QString> #include <QDir> +// Only if "fileName" is not absolute, prepend the "absoluteBase". +static QString assemblePath(const fs::path& absoluteBase, + const string& fileName) { + return QDir(QString::fromStdString((const string&) absoluteBase)) + .absoluteFilePath(QString::fromStdString(fileName)); +} + bool QtUseGUI() { #ifdef Q_WS_X11 @@ -521,11 +528,11 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha if (!inputFiles.size()) inputFiles.push_back(""); #ifdef ENABLE_MDI BOOST_FOREACH(const string &infile, inputFiles) { - new MainWindow(QString::fromLocal8Bit(infile.empty() ? infile.c_str() : boosty::stringy(original_path / infile).c_str())); + new MainWindow(assemblePath(original_path, infile)); } app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); #else - MainWindow *m = new MainWindow(QString::fromLocal8Bit(inputFiles[0].empty() ? inputFiles[0].c_str() : boosty::stringy(original_path / inputFiles[0]).c_str())); + MainWindow *m = new MainWindow(assemblePath(original_path, inputFiles[0])); app.connect(m, SIGNAL(destroyed()), &app, SLOT(quit())); #endif return app.exec(); |