Commit 9f1260e3 authored by Cyril Rohr's avatar Cyril Rohr
Browse files

Modified generator so that it doesn't write a hard link if it already exists

parent 04e3cf52
...@@ -121,10 +121,10 @@ class ReferenceGenerator ...@@ -121,10 +121,10 @@ class ReferenceGenerator
groups.has_key?(G5K::Link) and groups[G5K::Link].each do |link| groups.has_key?(G5K::Link) and groups[G5K::Link].each do |link|
from = File.join(repository, "#{link.from}.json") from = File.join(repository, "#{link.from}.json")
to = File.join(repository, link.path) to = File.join(repository, link.path)
# Hard links will always be regenerated unless File.exists?(to)
# TODO: find a way to detect if a link has to be regenerated puts "Hard link to be written = \t#{to} -> #{from}"
puts "Hard link to be written = \t#{to} -> #{from}" FileUtils.link(from, to, :force => true) unless options[:simulate]
FileUtils.link(from, to, :force => true) unless options[:simulate] end
end end
end end
......
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