mirror of
https://github.com/reactos/CMake.git
synced 2025-02-12 06:51:00 +00:00
ENH: Preserve permissions when copying files
This commit is contained in:
parent
900ad59867
commit
09421a261c
@ -74,6 +74,8 @@ void cmConfigureFileCommand::ConfigureFile()
|
|||||||
{
|
{
|
||||||
m_Makefile->AddCMakeDependFile(m_InputFile.c_str());
|
m_Makefile->AddCMakeDependFile(m_InputFile.c_str());
|
||||||
cmSystemTools::ConvertToUnixSlashes(m_OuputFile);
|
cmSystemTools::ConvertToUnixSlashes(m_OuputFile);
|
||||||
|
mode_t perm = 0;
|
||||||
|
cmSystemTools::GetPermissions(m_InputFile.c_str(), perm);
|
||||||
std::string::size_type pos = m_OuputFile.rfind('/');
|
std::string::size_type pos = m_OuputFile.rfind('/');
|
||||||
if(pos != std::string::npos)
|
if(pos != std::string::npos)
|
||||||
{
|
{
|
||||||
@ -142,6 +144,7 @@ void cmConfigureFileCommand::ConfigureFile()
|
|||||||
cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(),
|
cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(),
|
||||||
m_OuputFile.c_str());
|
m_OuputFile.c_str());
|
||||||
cmSystemTools::RemoveFile(tempOutputFile.c_str());
|
cmSystemTools::RemoveFile(tempOutputFile.c_str());
|
||||||
|
cmSystemTools::SetPermissions(m_OuputFile.c_str(), perm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,7 +810,19 @@ bool cmSystemTools::DoesFileExistWithExtensions(
|
|||||||
|
|
||||||
bool cmSystemTools::cmCopyFile(const char* source, const char* destination)
|
bool cmSystemTools::cmCopyFile(const char* source, const char* destination)
|
||||||
{
|
{
|
||||||
return Superclass::CopyFileAlways(source, destination);
|
mode_t perm = 0;
|
||||||
|
return cmSystemTools::GetPermissions(source, perm) &&
|
||||||
|
Superclass::CopyFileAlways(source, destination) &&
|
||||||
|
cmSystemTools::SetPermissions(destination, perm);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cmSystemTools::CopyFileIfDifferent(const char* source,
|
||||||
|
const char* destination)
|
||||||
|
{
|
||||||
|
mode_t perm = 0;
|
||||||
|
return cmSystemTools::GetPermissions(source, perm) &&
|
||||||
|
Superclass::CopyFileIfDifferent(source, destination) &&
|
||||||
|
cmSystemTools::SetPermissions(destination, perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmSystemTools::Glob(const char *directory, const char *regexp,
|
void cmSystemTools::Glob(const char *directory, const char *regexp,
|
||||||
|
@ -150,6 +150,8 @@ public:
|
|||||||
|
|
||||||
///! Copy a file.
|
///! Copy a file.
|
||||||
static bool cmCopyFile(const char* source, const char* destination);
|
static bool cmCopyFile(const char* source, const char* destination);
|
||||||
|
static bool CopyFileIfDifferent(const char* source,
|
||||||
|
const char* destination);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run an executable command and put the stdout in output.
|
* Run an executable command and put the stdout in output.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user