• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ossia / score / 31975605394

16 Aug 2026 10:10PM UTC coverage: 20.35%. First build
31975605394

Pull #2211

github

web-flow
Merge 1defa584c into bb5e533af
Pull Request #2211: project: collect, relink, trim and archive a project's files

1182 of 1996 new or added lines in 43 files covered. (59.22%)

43464 of 213584 relevant lines covered (20.35%)

5552.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.8
/src/plugins/score-lib-process/Process/ProjectArchive.cpp
1
#include <Process/ProjectArchive.hpp>
2
#include <Process/ProjectConsolidation.hpp>
3

4
#include <score/document/DocumentContext.hpp>
5

6
#include <core/document/Document.hpp>
7

8
#include <QFileInfo>
9
#include <QSet>
10

11
namespace Process
12
{
13

14
std::vector<score::ZipEntry>
15
projectArchiveContents(const score::DocumentContext& ctx, const FileReport& report)
2✔
16
{
17
  const QString documentFile = ctx.document.metadata().fileName();
2✔
18
  const QFileInfo docInfo{documentFile};
2✔
19
  const QString folder
20
      = report.projectFolder.isEmpty() ? docInfo.absolutePath() : report.projectFolder;
2✔
21
  if(folder.isEmpty())
2✔
NEW
22
    return {};
×
23

24
  const QString root = docInfo.completeBaseName().isEmpty()
4✔
NEW
25
                           ? QStringLiteral("project")
×
26
                           : docInfo.completeBaseName();
2✔
27

28
  std::vector<score::ZipEntry> out;
2✔
29
  QSet<QString> seen;
2✔
30

31
  const auto add = [&](const QString& absolute) {
5✔
32
    if(absolute.isEmpty() || !QFileInfo{absolute}.isFile())
3✔
33
      return;
1✔
34
    if(!score::isUnderFolder(absolute, folder))
2✔
NEW
35
      return;
×
36

37
    QString relative = absolute.mid(folder.size());
2✔
38
    while(relative.startsWith('/'))
4✔
39
      relative.remove(0, 1);
2✔
40
    if(relative.isEmpty())
2✔
NEW
41
      return;
×
42

43
    const QString name = root + '/' + relative;
2✔
44
    if(seen.contains(name))
2✔
NEW
45
      return;
×
46
    seen.insert(name);
2✔
47
    out.push_back({absolute, name});
2✔
48
  };
3✔
49

50
  // Unconditionally, and at the archive root: a project archived into a folder
51
  // the document does not live in would otherwise come out without it.
52
  if(docInfo.isFile())
2✔
53
  {
54
    const QString name = root + '/' + docInfo.fileName();
2✔
55
    seen.insert(name);
2✔
56
    out.push_back({docInfo.absoluteFilePath(), name});
2✔
57
  }
2✔
58

59
  for(const auto& e : report.entries)
5✔
60
  {
61
    // Whatever the reference ends up pointing at: a file just collected, or
62
    // one that was already in the project and only had its path rewritten.
63
    add(e.destinationPath.isEmpty() ? e.sourcePath : e.destinationPath);
3✔
64
  }
65

66
  return out;
2✔
67
}
2✔
68

69
qint64 archiveContentsSize(const std::vector<score::ZipEntry>& entries) noexcept
1✔
70
{
71
  qint64 total = 0;
1✔
72
  for(const auto& e : entries)
3✔
73
    total += QFileInfo{e.sourceFile}.size();
2✔
74
  return total;
1✔
75
}
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc