Clear converted markdown directory before running mix task

This commit is contained in:
Catalin Constantin Mititiuc 2024-12-11 17:54:55 -08:00
parent 9e8392a939
commit 192d65a059

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 ->