set_program: Set the location of a dependency program

View source: R/program_management.R

set_programR Documentation

Set the location of a dependency program

Description

set_program() saves the location of a program, so the package can find it in later sessions. set_ffmpeg(), set_ffprobe(), set_ffplay() and set_mediainfo() do the same for one program each.

The location goes in a file named after the program, such as ffmpeg_location.txt. The file is under tools::R_user_dir("tidymedia", "config"). find_ffmpeg() and the other ⁠find_*()⁠ functions read it when the program is not on the PATH.

Usage

set_program(
  program = c("ffmpeg", "ffprobe", "ffplay", "mediainfo"),
  location,
  confirm = TRUE
)

set_mediainfo(location, confirm = TRUE)

set_ffmpeg(location, confirm = TRUE)

set_ffprobe(location, confirm = TRUE)

set_ffplay(location, confirm = TRUE)

Arguments

program

A string naming the program to set the location for.

location

A string with the location of the program.

confirm

Whether to ask before the call writes the location. TRUE, the default, asks. In a session where no one can answer, TRUE gives an error. FALSE writes without asking.

Details

The file stays after the session ends, so the call asks you to confirm first. It writes nothing until you agree. The question shows the location the call writes, which is the location as you typed it. The one change is a leading ~, which is written as your home folder in full. The question also shows the full path of the file. If you say no, the call changes nothing.

In a session where no one can answer, the call gives an error. Pass confirm = FALSE to write without the question, for example in a script that runs on its own.

For locations saved by versions before 0.2.0, see the section "Locations saved by earlier versions" in find_ffmpeg().

Value

Invisibly, TRUE when the call wrote the location and FALSE when you said no.

See Also

find_ffmpeg() and the other ⁠find_*()⁠ functions to find a program, and install_on_win() to download FFmpeg on Windows.

Other program management functions: find_ffmpeg(), install_on_win(), program_status(), unset_program()

Examples

## Not run: 
# Point tidymedia at a binary in a non-standard location; asks first
set_mediainfo("C:/Program Files/MediaInfo/mediainfo.exe")

# In an unattended script, where there is no one to ask
set_mediainfo("C:/Program Files/MediaInfo/mediainfo.exe", confirm = FALSE)

## End(Not run)

tidymedia documentation built on Oct. 11, 2026, 5:08 p.m.