1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCPackComponentGroup.cxx,v $
6 Date: $Date: 2008-07-09 17:38:55 $
7 Version: $Revision: 1.1 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #include "cmCPackComponentGroup.h"
19 #include "cmSystemTools.h"
23 //----------------------------------------------------------------------
24 unsigned long cmCPackComponent::GetInstalledSize(const char* installDir
) const
26 if (this->TotalSize
!= 0)
28 return this->TotalSize
;
31 std::vector
<std::string
>::const_iterator fileIt
;
32 for (fileIt
= this->Files
.begin(); fileIt
!= this->Files
.end(); ++fileIt
)
34 std::string path
= installDir
;
37 this->TotalSize
+= cmSystemTools::FileLength(path
.c_str());
40 return this->TotalSize
;
43 //----------------------------------------------------------------------
45 cmCPackComponent::GetInstalledSizeInKbytes(const char* installDir
) const
47 unsigned long result
= (GetInstalledSize(installDir
) + 512) / 1024;
48 return result
? result
: 1;