diff options
author | Christian Kandeler <[email protected]> | 2024-09-11 17:04:01 +0200 |
---|---|---|
committer | Christian Kandeler <[email protected]> | 2024-09-16 12:08:21 +0000 |
commit | 05430afdcf1e10f4cc9b43407f996993a6175854 (patch) | |
tree | bec0a81c89ba9e38c28a3760ea24e60a7286cf5d /src/plugins/nim | |
parent | ff44f589f5299d358274332d6d791a98a934dacc (diff) |
ProjectExplorer: Let build systems do renamings in bulk
Like for the add and remove operations.
Change-Id: I734396b1b0f5a4ffb9cf193a0e32c8f7f60259ae
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/plugins/nim')
-rw-r--r-- | src/plugins/nim/project/nimblebuildsystem.cpp | 12 | ||||
-rw-r--r-- | src/plugins/nim/project/nimblebuildsystem.h | 6 | ||||
-rw-r--r-- | src/plugins/nim/project/nimbuildsystem.cpp | 17 |
3 files changed, 28 insertions, 7 deletions
diff --git a/src/plugins/nim/project/nimblebuildsystem.cpp b/src/plugins/nim/project/nimblebuildsystem.cpp index 91f4eb2f202..b08a3f6dc04 100644 --- a/src/plugins/nim/project/nimblebuildsystem.cpp +++ b/src/plugins/nim/project/nimblebuildsystem.cpp @@ -234,9 +234,17 @@ bool NimbleBuildSystem::deleteFiles(Node *, const FilePaths &) return true; } -bool NimbleBuildSystem::renameFile(Node *, const FilePath &oldFilePath, const FilePath &newFilePath) +bool NimbleBuildSystem::renameFiles(Node *, const FilePairs &filesToRename, FilePaths *notRenamed) { - return m_projectScanner.renameFile(oldFilePath.toString(), newFilePath.toString()); + bool success = true; + for (const auto &[oldFilePath, newFilePath] : filesToRename) { + if (!m_projectScanner.renameFile(oldFilePath.toString(), newFilePath.toString())) { + success = false; + if (notRenamed) + *notRenamed << oldFilePath; + } + } + return success; } } // Nim diff --git a/src/plugins/nim/project/nimblebuildsystem.h b/src/plugins/nim/project/nimblebuildsystem.h index 63fef296bef..78e130ea746 100644 --- a/src/plugins/nim/project/nimblebuildsystem.h +++ b/src/plugins/nim/project/nimblebuildsystem.h @@ -58,8 +58,10 @@ private: const Utils::FilePaths &filePaths, Utils::FilePaths *) override; bool deleteFiles(ProjectExplorer::Node *, const Utils::FilePaths &) override; - bool renameFile(ProjectExplorer::Node *, - const Utils::FilePath &oldFilePath, const Utils::FilePath &newFilePath) override; + bool renameFiles( + ProjectExplorer::Node *, + const Utils::FilePairs &filesToRename, + Utils::FilePaths *notRenamed) override; QString name() const final { return QLatin1String("mimble"); } void triggerParsing() final; diff --git a/src/plugins/nim/project/nimbuildsystem.cpp b/src/plugins/nim/project/nimbuildsystem.cpp index 39acc8635d0..0458d847bd1 100644 --- a/src/plugins/nim/project/nimbuildsystem.cpp +++ b/src/plugins/nim/project/nimbuildsystem.cpp @@ -152,7 +152,10 @@ public: const FilePaths &filePaths, FilePaths *) final; bool deleteFiles(Node *, const FilePaths &) final; - bool renameFile(Node *, const FilePath &oldFilePath, const FilePath &newFilePath) final; + bool renameFiles( + Node *, + const Utils::FilePairs &filesToRename, + Utils::FilePaths *notRenamed) final; QString name() const final { return QLatin1String("nim"); } void triggerParsing() final; @@ -237,9 +240,17 @@ bool NimBuildSystem::deleteFiles(Node *, const FilePaths &) return true; } -bool NimBuildSystem::renameFile(Node *, const FilePath &oldFilePath, const FilePath &newFilePath) +bool NimBuildSystem::renameFiles(Node *, const FilePairs &filesToRename, FilePaths *notRenamed) { - return m_projectScanner.renameFile(oldFilePath.toString(), newFilePath.toString()); + bool success = true; + for (const auto &[oldFilePath, newFilePath] : filesToRename) { + if (!m_projectScanner.renameFile(oldFilePath.toString(), newFilePath.toString())) { + success = false; + if (notRenamed) + *notRenamed << oldFilePath; + } + } + return success; } BuildSystem *createNimBuildSystem(Target *target) |