Commit 2cb671fa authored by Samuel Giddins's avatar Samuel Giddins

Avoid “creating” the same directory over & over

parent 0d2d7718
......@@ -109,13 +109,13 @@ module Pod
# @return [Object] the result of the generator.
#
def update_changed_file(generator, path)
path.dirname.mkpath
if path.exist?
result = generator.save_as(support_files_temp_dir)
unless FileUtils.identical?(support_files_temp_dir, path)
FileUtils.mv(support_files_temp_dir, path)
end
else
path.dirname.mkpath
result = generator.save_as(path)
end
clean_support_files_temp_dir if support_files_temp_dir.exist?
......
......@@ -96,6 +96,7 @@ module Pod
# @return [Array<Pathname>]
#
def add_files(namespace, relative_header_paths)
root.join(namespace).mkpath unless relative_header_paths.empty?
relative_header_paths.map do |relative_header_path|
add_file(namespace, relative_header_path)
end
......@@ -115,9 +116,9 @@ module Pod
#
# @return [Pathname]
#
def add_file(namespace, relative_header_path)
def add_file(namespace, relative_header_path, directory_made: false)
namespaced_path = root + namespace
namespaced_path.mkpath unless File.exist?(namespaced_path)
namespaced_path.mkpath unless directory_made
absolute_source = (sandbox.root + relative_header_path)
source = absolute_source.relative_path_from(namespaced_path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment