why not pass a vector of raster data instead of file names? if you create raster data dynamically via GUI, you would like to use the data directly here instead of files.