From 36f7c3a0c7f153073015711e6ee7f0c3d305b0dc Mon Sep 17 00:00:00 2001 From: Oleksandr Date: Tue, 19 Nov 2024 16:33:10 +0200 Subject: [PATCH] fix case with duplicated ip v files when currentfileset is not initialized(right after aurora startup) --- src/MainWindow/main_window_ql.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/MainWindow/main_window_ql.cpp b/src/MainWindow/main_window_ql.cpp index 9b1bd13e6..a38246e90 100644 --- a/src/MainWindow/main_window_ql.cpp +++ b/src/MainWindow/main_window_ql.cpp @@ -247,6 +247,12 @@ MainWindow::MainWindow(Session* session) m_ipConfiguratorProcess = std::make_shared(); connect(m_ipConfiguratorProcess.get(), &QLIpConfiguratorProcess::resultReady, this, [this](std::filesystem::path buildPath, std::vector filePathes){ auto existedDesignFiles = m_projectManager->getDesignFiles(); + // before we add new design file, the current fileset could be empty, so init it with default + QString currentFileSet = m_projectManager->currentFileSet(); + if (currentFileSet.isEmpty()) { + currentFileSet = DEFAULT_FOLDER_SOURCE; + } + // QList acceptedFiles; QList rejectedFiles; @@ -260,7 +266,7 @@ MainWindow::MainWindow(Session* session) } QString localFilePath = m_projectManager->ProjectFilesPath("", m_projectManager->getProjectName(), - m_projectManager->currentFileSet(), fileInfo.fileName()); + currentFileSet, fileInfo.fileName()); if (!localFilePath.startsWith(PROJECT_OSRCDIR)) { localFilePath.prepend(QString(PROJECT_OSRCDIR) + "/"); @@ -288,7 +294,7 @@ MainWindow::MainWindow(Session* session) for (const auto& origFilePath: rejectedFiles) { QFileInfo fileInfo{origFilePath}; QString destFilePath = m_projectManager->ProjectFilesPath(m_projectManager->getProjectPath(), m_projectManager->getProjectName(), - m_projectManager->currentFileSet(), fileInfo.fileName()); + currentFileSet, fileInfo.fileName()); FileUtils::overwriteFile(std::filesystem::path(origFilePath.toStdString()), std::filesystem::path(destFilePath.toStdString())); }