1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #include "cmCPackComponentGroup.h"
7 #include "cmStringAlgorithms.h"
8 #include "cmSystemTools.h"
10 unsigned long cmCPackComponent::GetInstalledSize(
11 const std::string
& installDir
) const
13 if (this->TotalSize
!= 0) {
14 return this->TotalSize
;
17 for (std::string
const& file
: this->Files
) {
18 std::string path
= cmStrCat(installDir
, '/', file
);
19 this->TotalSize
+= cmSystemTools::FileLength(path
);
22 return this->TotalSize
;
25 unsigned long cmCPackComponent::GetInstalledSizeInKbytes(
26 const std::string
& installDir
) const
28 unsigned long result
= (this->GetInstalledSize(installDir
) + 512) / 1024;
29 return result
? result
: 1;