diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 9b0040982..234b4e24a 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3284,6 +3284,31 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu return false; } + try + { + // Here comes undocumented Valentina's feature. + // Because app bundle in Mac OS X doesn't allow setup assosiation for Tape we must do this through Valentina + VMeasurements m(pattern); + m.setXMLContent(fileName); + + if (m.Type() == MeasurementsType::Standard || m.Type() == MeasurementsType::Individual) + { + const QString tape = qApp->TapeFilePath(); + const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath(); + QProcess::startDetached(tape, QStringList(fileName), workingDirectory); + qApp->exit(V_EX_OK); + return false; // stop continue processing + } + } + catch (VException &e) + { + qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), + qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); + Clear(); + qApp->exit(V_EX_NOINPUT); + return false; + } + qCDebug(vMainWindow, "Loking file"); VlpCreateLock(lock, fileName); @@ -3867,7 +3892,7 @@ void MainWindow::ProcessCMD() return; // process only one input file } - if (cmd->IsTestModeEnabled() || cmd->IsExportEnabled()) + if (loaded && (cmd->IsTestModeEnabled() || cmd->IsExportEnabled())) { if (cmd->IsSetGradationSize()) {