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 6, 2024
1 parent 2bcf81b commit cab06c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -12,7 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`

##### Bug Fixes

* None.
* Fix an issue when caching downloads of certain Pods.
[Eric Amorde](https://github.com/amorde)
[#12226](https://github.com/CocoaPods/CocoaPods/issues/12226)


## 1.15.0 (2024-01-28)
Expand Down
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 cab06c3

Please sign in to comment.