lib/sitemap/generator.rb in sitemap-0.2b vs lib/sitemap/generator.rb in sitemap-0.2b2
- old
+ new
@@ -144,11 +144,11 @@
def save(location)
if fragments.length == 1
FileUtils.mv(fragments.first.path, location)
else
remove_saved_files(location)
- root = File.join(Pathname.new(location).dirname, "sitemap")
+ root = File.join(Pathname.new(location).dirname, "sitemaps")
Dir.mkdir(root) unless File.directory?(root)
fragments.each_with_index do |fragment, i|
file_pattern = File.join(root, "sitemap-fragment-#{i + 1}.xml")
FileUtils.mv(fragment.path, file_pattern)
end
@@ -164,10 +164,10 @@
def file_url(path = "sitemap.xml")
URI::HTTP.build(:host => host, :path => File.join("/", path)).to_s
end
def remove_saved_files(location)
- root = File.join(Pathname.new(location).dirname, "sitemap")
+ root = File.join(Pathname.new(location).dirname, "sitemaps")
Dir[File.join(root, "sitemap-fragment-*.xml")].each { |file| File.unlink(file) }
File.unlink(location) if File.exist?(location)
end
private