2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2008-07-09 21:38:56 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2008-07-09 21:38:56 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2008-07-09 21:38:56 +04:00
|
|
|
|
|
|
|
#include "cmCPackComponentGroup.h"
|
2016-04-29 16:40:20 +03:00
|
|
|
|
2008-07-09 21:38:56 +04:00
|
|
|
#include "cmSystemTools.h"
|
2016-04-29 16:40:20 +03:00
|
|
|
|
2008-07-09 21:38:56 +04:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2014-02-22 04:05:55 +04:00
|
|
|
unsigned long cmCPackComponent::GetInstalledSize(
|
|
|
|
const std::string& installDir) const
|
2008-07-09 21:38:56 +04:00
|
|
|
{
|
|
|
|
if (this->TotalSize != 0)
|
|
|
|
{
|
|
|
|
return this->TotalSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::string>::const_iterator fileIt;
|
|
|
|
for (fileIt = this->Files.begin(); fileIt != this->Files.end(); ++fileIt)
|
|
|
|
{
|
|
|
|
std::string path = installDir;
|
|
|
|
path += '/';
|
|
|
|
path += *fileIt;
|
2014-11-23 13:05:50 +03:00
|
|
|
this->TotalSize += cmSystemTools::FileLength(path);
|
2008-07-09 21:38:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return this->TotalSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2012-08-13 21:42:58 +04:00
|
|
|
unsigned long
|
2014-02-22 04:05:55 +04:00
|
|
|
cmCPackComponent::GetInstalledSizeInKbytes(const std::string& installDir) const
|
2008-07-09 21:38:56 +04:00
|
|
|
{
|
|
|
|
unsigned long result = (GetInstalledSize(installDir) + 512) / 1024;
|
|
|
|
return result? result : 1;
|
|
|
|
}
|