diff --git a/build-agda-html.rb b/build-agda-html.rb
index 4cc3d8a..ecb86d5 100644
--- a/build-agda-html.rb
+++ b/build-agda-html.rb
@@ -1,6 +1,7 @@
require "json"
require "set"
require "optparse"
+require "fileutils"
# For target_dir, use absolute paths because when invoking Agda, we'll be
# using chdir.
@@ -56,6 +57,8 @@ files_for_paths.each do |path, files|
Dir.chdir(original_wd)
Dir.chdir(File.join(root_path, path))
html_dir = File.join [target_dir, path, "html"]
+ FileUtils.mkdir_p html_dir
+
files.each do |file|
command = "#{ARGV[0]} --local-interfaces #{file} --html --html-dir=#{html_dir}"
puts command