Clear converted markdown directory before running mix task

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-17 11:17:37 -07:00
parent ef76548337
commit a248af3d3c

View File

@ -24,8 +24,15 @@ defmodule Mix.Tasks.Pandoc do
profile = String.to_atom(profile)
config = Application.get_env(:pandoc, profile)
args = config[:args] || []
opts = [cd: config[:cd] || File.cwd!()]
(config[:cd] || File.cwd!())
out_path = List.last(args)
full_out_path = [opts[:cd], out_path] |> Path.join() |> Path.expand()
File.rm_rf!(full_out_path)
File.mkdir_p!(full_out_path)
opts[:cd]
|> Path.join("*#{@ext}")
|> Path.wildcard()
|> Enum.each(fn path ->