Uses Sys.which
to check if command is in the PATH.
dcmtk_cmd_path(cmd)
cmd | DCMTK command name |
---|
Logical TRUE
if command is available.
if (!have_dcmtk_cmd("dcmodify")) {
install_dir = tempdir()
options(dcmtk.path = install_dir)
res = try({
install_dcmtk(install_dir = install_dir)
})
if (inherits(res, "try-error")) {
res = FALSE
}
if (!res) {
source_install_dcmtk(install_dir = install_dir)
}
}
dcmtk_cmd("dcmodify")
#> /tmp/RtmpbIKxLr/bin/dcmodify
#> [1] 126