Skip to content

Commit

Permalink
fix: support mmdc on windows (#319)
Browse files Browse the repository at this point in the history
I am not sure if Windows platform support is of any importance but I
encountered an issue where `mmdc` cannot be found on Windows. This is
due to this
[issue](https://doc.rust-lang.org/std/process/struct.Command.html#implementations)
where `Command::new()` on Windows works in this way: "if the file has a
different extension, a filename including the extension needs to be
provided, otherwise the file won’t be found.".

Since mmdc on Windows is an alias for the `mmdc.cmd` script and not an
`exe`, this updates the name used to find the mmdc tool.
  • Loading branch information
mfontanini authored Aug 2, 2024
2 parents fb53aa0 + b52dbb9 commit 4047edb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ impl ThirdPartyTools {
}

pub(crate) fn mermaid(args: &[&str]) -> Tool {
Tool::new("mmdc", args)
let mmdc = if cfg!(windows) { "mmdc.cmd" } else { "mmdc" };
Tool::new(mmdc, args)
}

pub(crate) fn presenterm_export(args: &[&str]) -> Tool {
Expand Down

0 comments on commit 4047edb

Please sign in to comment.