From a248af3d3c5e7d37a27decd3ffa1693f39fd82ac Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Tue, 17 Jun 2025 11:17:37 -0700 Subject: [PATCH] Clear converted markdown directory before running mix task --- lib/mix/tasks/pandoc.ex | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/mix/tasks/pandoc.ex b/lib/mix/tasks/pandoc.ex index 94d7dd5..179eab8 100644 --- a/lib/mix/tasks/pandoc.ex +++ b/lib/mix/tasks/pandoc.ex @@ -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 ->