Adding exiftool to a golem shiny package #780
Replies: 1 comment
-
Hey @zcfogel-idfg, Thanks for your question. There are two sides to this question:
For example : > system.file("img", package = "golem")
[1] "/Library/Frameworks/R.framework/Versions/4.1/Resources/library/golem/img" Will refer to the Also, if you do So you can reliably refer to this folder on every computer that has the package installed, hence you can read/write inside it. That being said, you should be aware that if you wish to send the package on the CRAN, that the CRAN doesn't allow packages that silently write to the user computer. Best, |
Beta Was this translation helpful? Give feedback.
-
I am in the process of converting an existing shiny app into a golem shiny package. The app is used for copying photos from SD cards to hard drives and renaming the photos once they have been copied to the hard drive. It renames them based on the photo UserLabel (the camera ID) and the date and time that the photo was taken. The app is run locally on the user’s computer rather than on a shiny server, and it has the user install Strawberry perl in order to utilize exiftool. It uses a combination of the exifr package and exiftool (run through a
system2()
call). The parts of the app that use exifr work fine when the app is in the form of a standard R project and after it was converted to a golem app. The part that runs exiftool throughsystem2()
work as an R project, but not in golem; it displays the error “exiftool not found
.”The segment using exiftool is currently written as such:
rename_cmnd <- paste("inst/app/www/exiftool -r -d %Y%m%d_%H%M%S \"-filename<",new_folder,"/${userlabel;s/ //g}/",vals$pcode,"_${userlabel;s/ //g}_${DateTimeOriginal}_${triggermode;s/(.)(.*\\s)(.)(.*)/$1$3/}${sequence;s/(\\d)(.*)/_$1/}.%e\" ", input$selectedBatch, sep = "”)
whereinput$selectedBatch
,new_folder
, andvals$pcode
are user-input values. Then, I actually call that command withrcd<-system2(rename_cmnd)
.Vincent at ThinkR said "once your golem is installed, a file localised in inst/app/www/exiftool will be available with
system.file(package="yourgolemname","app","www","exiftool")
." I am unsure where/when I callsystem.file()
. Is it instead ofsystem2()
? Or beforesystem2()
? Or once I've loaded the app but beforerun_app()
?Additionally, my package name (for now) is sdApp, and the R Project is called sd_package_v3.0; I assume that I do
package='sdApp'
?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions