Skip to content

Commit ecc7ea9

Browse files
committed
Merge branch 'master' of github.com:mbsim-env/mbsim
2 parents 4244a6a + 2d6d9c4 commit ecc7ea9

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

mbsimgui/RELEASENOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Release NEXT
1+
Release 10.3
22
============
33

44
All

mbsimgui/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl Process this file with autoconf to produce a configure script.
22
AC_PREREQ([2.57])
3-
AC_INIT([mbsimgui],[10.2],[martin.o.foerg@googlemail.com])
3+
AC_INIT([mbsimgui],[10.3],[martin.o.foerg@googlemail.com])
44
AC_CONFIG_HEADER(config.h)
55
AM_INIT_AUTOMAKE([subdir-objects])
66
AC_CONFIG_SRCDIR([mbsimgui/body.h])

mbsimgui/mbsimgui/mainwindow.cc

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ namespace MBSimGUI {
839839
IDcounter = 0;
840840

841841
doc = impl->createDocument();
842-
doc->setDocumentURI(X()%QUrl::fromLocalFile(QDir::currentPath()+"/Project.mbsx").toString().toStdString());
842+
doc->setDocumentURI(X()%QDir::current().absoluteFilePath("Project.mbsx").toStdString());
843843

844844
project = new Project;
845845
project->createXMLElement(doc);
@@ -863,9 +863,13 @@ namespace MBSimGUI {
863863
list << fileInfoList.at(i).baseName();
864864
}
865865
NewProjectFromTemplateDialog dialog(list,this);
866-
if(dialog.exec())
867-
loadProject(fileInfoList.at(dialog.getSelectedRow()).absoluteFilePath(),false);
868-
doc->setDocumentURI(X()%QUrl::fromLocalFile(QDir::currentPath()+"/Project.mbsx").toString().toStdString());
866+
if(dialog.exec()) {
867+
auto file = fileInfoList.at(dialog.getSelectedRow()).absoluteFilePath();
868+
if(file.startsWith("//"))
869+
file.replace('/','\\'); // xerces-c is not able to parse files from network shares that begin with "//"
870+
loadProject(file,false);
871+
}
872+
doc->setDocumentURI(X()%QDir::current().absoluteFilePath("Project.mbsx").toStdString());
869873
}
870874

871875
void MainWindow::loadProject(const QString &fileName, bool updateRecent) {
@@ -958,7 +962,9 @@ namespace MBSimGUI {
958962
QString file=QFileDialog::getSaveFileName(this, "Save MBSim file", getProjectFilePath(), "MBSim files (*.mbsx)");
959963
if(not(file.isEmpty())) {
960964
file = file.endsWith(".mbsx")?file:file+".mbsx";
961-
doc->setDocumentURI(X()%QUrl::fromLocalFile(file).toString().toStdString());
965+
if(file.startsWith("//"))
966+
file.replace('/','\\'); // xerces-c is not able to parse files from network shares that begin with "//"
967+
doc->setDocumentURI(X()%file.toStdString());
962968
projectFile = QDir::current().relativeFilePath(file);
963969
setCurrentProjectFile(file);
964970
setWindowTitle(projectFile+"[*]");
@@ -2730,9 +2736,9 @@ namespace MBSimGUI {
27302736
for (int i = 0; i < event->mimeData()->urls().size(); i++) {
27312737
QString path = event->mimeData()->urls()[i].toLocalFile().toLocal8Bit().data();
27322738
if(path.endsWith(".mbsx")) {
2733-
QFile Fout(path);
2734-
if (Fout.exists())
2735-
loadProject(Fout.fileName());
2739+
if(path.startsWith("//"))
2740+
path.replace('/','\\'); // xerces-c is not able to parse files from network shares that begin with "//"
2741+
loadProject(path);
27362742
}
27372743
}
27382744
}

mbsimgui/mbsimgui/variable_widgets.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,8 +1321,10 @@ namespace MBSimGUI {
13211321
}
13221322

13231323
vector<vector<QString>> FromFileWidget::getEvalMat() const {
1324-
string file = mw->eval->cast<MBXMLUtils::CodeString>(mw->eval->stringToValue((path->isChecked()?getFile():mw->getProjectDir().absoluteFilePath(getFile())).toStdString(),mw->getProject()->getXMLElement(),false));
1325-
QString str = QString::fromStdString(mw->eval->cast<MBXMLUtils::CodeString>(mw->eval->stringToValue("ret=load(" + file + ")",mw->getProject()->getXMLElement())));
1324+
vector<MBXMLUtils::Eval::Value> args(1);
1325+
args[0] = mw->eval->stringToValue((path->isChecked()?getFile():mw->getProjectDir().absoluteFilePath(getFile())).toStdString(),mw->getProject()->getXMLElement(),false);
1326+
auto ret = mw->eval->callFunction("load",args);
1327+
auto str = QString::fromStdString(mw->eval->cast<MBXMLUtils::CodeString>(ret));
13261328
str = removeWhiteSpace(str);
13271329
return strToMat((str));
13281330
}

0 commit comments

Comments
 (0)