Skip to content

Commit

Permalink
Fix an issue attempting to re-copy the same file when the destination…
Browse files Browse the repository at this point in the history
… does not have write permissions
  • Loading branch information
amorde committed Feb 5, 2024
1 parent 2bcf81b commit 129a45d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cocoapods/downloader/cache.rb
Expand Up @@ -327,13 +327,15 @@ def copy_source_and_clean(source, destination, spec)
# @return [Void]
#
def copy_files(files, source, destination)
files = files.select { |f| File.exist?(f) }
files = files
.map { |f| Pathname(f) }
.select { |p| p.exist? && p.file? }
destination.parent.mkpath
Cache.write_lock(destination) do
FileUtils.rm_rf(destination)
destination.mkpath
files_by_dir = files.group_by do |file|
relative_path = Pathname(file).relative_path_from(Pathname(source)).to_s
relative_path = file.relative_path_from(source)
destination_path = File.join(destination, relative_path)
File.dirname(destination_path)
end
Expand Down

0 comments on commit 129a45d

Please sign in to comment.