diff options
author | Brad King <brad.king@kitware.com> | 2006-08-17 16:07:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-08-17 16:07:51 (GMT) |
commit | b642ffa7a82922d99475fa38e9a7f317e029ebf3 (patch) | |
tree | 3ba1266dca3f76f62eaff8839f9aecca76310303 /Source | |
parent | d4ae4849f77082ee48f61e5b130ca6fd153b71ea (diff) | |
download | CMake-b642ffa7a82922d99475fa38e9a7f317e029ebf3.zip CMake-b642ffa7a82922d99475fa38e9a7f317e029ebf3.tar.gz CMake-b642ffa7a82922d99475fa38e9a7f317e029ebf3.tar.bz2 |
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).
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmFileCommand.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index bbf4265..80c69e6 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -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) |