@@ -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 }
0 commit comments