diff --git a/ChangeLog.txt b/ChangeLog.txt index 12d4e7374..51c4745a7 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -6,6 +6,7 @@ - [#325] Check pattern for inverse compatibility. # Version 0.4.2 +- Fixed broken path to measurements after using Save As option. - Tool line. Block selecting the same point twice. - [#443] Not valid dxf file. libdxf updated to version 3.12.2.0. Fixed drawing subpaths. - Fixed combobox width in Dialog "Tool True Dart point". diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index e6255c045..effd02107 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -2985,7 +2985,7 @@ bool MainWindow::SavePattern(const QString &fileName, QString &error) qCDebug(vMainWindow, "Saving pattern file %s.", qUtf8Printable(fileName)); QFileInfo tempInfo(fileName); - const QString mPath = doc->MPath(); + const QString mPath = AbsoluteMPath(curFile, doc->MPath()); if (not mPath.isEmpty() && curFile != fileName) { doc->SetPath(RelativeMPath(fileName, mPath)); diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index da7e8fed2..09b01a446 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -33,6 +33,7 @@ #include #include #include +#include // Keep synchronize all names with initialization in VTranslateVars class!!!!! //measurements @@ -1706,38 +1707,35 @@ QString StrippedName(const QString &fullFileName) //--------------------------------------------------------------------------------------------------------------------- QString RelativeMPath(const QString &patternPath, const QString &absoluteMPath) { - if (patternPath.isEmpty()) + if (patternPath.isEmpty() || absoluteMPath.isEmpty()) { return absoluteMPath; } - if (absoluteMPath.isEmpty() || QFileInfo(absoluteMPath).isRelative()) + if (QFileInfo(absoluteMPath).isRelative()) { + qWarning() << QApplication::tr("The path to the measurments is already relative."); return absoluteMPath; } - QDir dir(QFileInfo(patternPath).absoluteDir()); - return dir.relativeFilePath(absoluteMPath); + return QFileInfo(patternPath).absoluteDir().relativeFilePath(absoluteMPath); } //--------------------------------------------------------------------------------------------------------------------- QString AbsoluteMPath(const QString &patternPath, const QString &relativeMPath) { - if (patternPath.isEmpty()) + if (patternPath.isEmpty() || relativeMPath.isEmpty()) { return relativeMPath; } - else - { - if (relativeMPath.isEmpty() || QFileInfo(relativeMPath).isAbsolute()) - { - return relativeMPath; - } - return QFileInfo(QFileInfo(patternPath).absoluteDir(), relativeMPath).absoluteFilePath(); + if (QFileInfo(relativeMPath).isAbsolute()) + { + qWarning() << QApplication::tr("The path to the measurments is already absolute."); + return relativeMPath; } - return QString();// should never reach + return QFileInfo(QFileInfo(patternPath).absoluteDir(), relativeMPath).absoluteFilePath(); } //---------------------------------------------------------------------------------------------------------------------