ENH: Fix directory installation to properly deal with trailing slash names (using the rsync convention for whether the last directory name is included in naming the destination directory).

This commit is contained in:
Brad King 2006-08-17 12:07:51 -04:00
parent d4ae4849f7
commit b642ffa7a8
1 changed files with 11 additions and 4 deletions

View File

@ -741,13 +741,20 @@ bool cmFileCommand::HandleInstallCommand(
for ( i = 0; i < files.size(); i ++ )
{
// Split the input file into its directory and name components.
std::string fromDir = cmSystemTools::GetFilenamePath(files[i]);
std::string fromName = cmSystemTools::GetFilenameName(files[i]);
std::vector<std::string> fromPathComponents;
cmSystemTools::SplitPath(files[i].c_str(), fromPathComponents);
std::string fromName = *(fromPathComponents.end()-1);
std::string fromDir = cmSystemTools::JoinPath(fromPathComponents.begin(),
fromPathComponents.end()-1);
// Compute the full path to the destination file.
std::string toFile = destination;
toFile += "/";
toFile += rename.empty()? fromName : rename;
std::string const& toName = rename.empty()? fromName : rename;
if(!toName.empty())
{
toFile += "/";
toFile += toName;
}
// Handle type-specific installation details.
switch(itype)