this tests for the presence of the public dir and creates
it if needed. This situation can arise in a new install.
| ... | ... |
@@ -37,6 +37,7 @@ |
| 37 | 37 |
# Modified for Octopress by John W. Long |
| 38 | 38 |
# |
| 39 | 39 |
require 'rexml/document' |
| 40 |
+require 'fileutils' |
|
| 40 | 41 |
|
| 41 | 42 |
module Jekyll |
| 42 | 43 |
|
| ... | ... |
@@ -122,6 +123,9 @@ module Jekyll |
| 122 | 122 |
sitemap.add_element(urlset) |
| 123 | 123 |
|
| 124 | 124 |
# File I/O: create sitemap.xml file and write out pretty-printed XML |
| 125 |
+ unless File.exists?(site.dest) |
|
| 126 |
+ FileUtils.mkdir_p(site.dest) |
|
| 127 |
+ end |
|
| 125 | 128 |
file = File.new(File.join(site.dest, SITEMAP_FILE_NAME), "w") |
| 126 | 129 |
formatter = REXML::Formatters::Pretty.new(4) |
| 127 | 130 |
formatter.compact = true |