IPS-LMU / emuR

The main R package for the EMU Speech Database Management System (EMU-SDMS)
http://ips-lmu.github.io/EMU.html
23 stars 15 forks source link

export_TextGridCollection() fails disgracefully when bundlePattern doesn't exist #275

Open rpuggaardrode opened 4 months ago

rpuggaardrode commented 4 months ago

Hi Markus!

I had some issues with R bombing when I was using export_TextGridCollection() and traced it to a typo I made in bundlePattern. I should just stop making typos of course, but it could perhaps be nice to add a check to export_TextGridCollection() whether the bundle exists to avoid R crashing entirely.

This should reproduce the error:

library(emuR)

create_emuRdemoData(tempdir())
db_path <- paste0(tempdir(), '/emuR_demoData/ae_emuDB')
db <- load_emuDB(db_path)

export_TextGridCollection(db, tempdir(), bundlePattern='non_existing_bundle', verbose = FALSE)

Note that the crash only appears to happen with verbose = FALSE, because the utils progress bar function will shoot an error and cause the function to fail gracefully when verbose = TRUE.