Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / CPack / cmCPackComponentGroup.cxx
blobb2cd09dbeb62be6ab6ebea27c9c5e857c09c63c2
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCPackComponentGroup.cxx,v $
5 Language: C++
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"
20 #include <vector>
21 #include <string>
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;
35 path += '/';
36 path += *fileIt;
37 this->TotalSize += cmSystemTools::FileLength(path.c_str());
40 return this->TotalSize;
43 //----------------------------------------------------------------------
44 unsigned long
45 cmCPackComponent::GetInstalledSizeInKbytes(const char* installDir) const
47 unsigned long result = (GetInstalledSize(installDir) + 512) / 1024;
48 return result? result : 1;