wait_for_writable: Check if a file is writable and blocks an interactive...

View source: R/fcn_misc.R

wait_for_writableR Documentation

Check if a file is writable and blocks an interactive session, waiting for user input.

Description

This functions gives the user a chance to make the output file writeable before a write attempt is actually made by R to avoid having run the whole program again upon write failure.

Usage

wait_for_writable(
  filename,
  prompt_text = paste0("The file '", filename,
    "' is not writable. Please close all applications using this file. Press '",
    abort_answer, "' to abort!"),
  abort_answer = "n"
)

Arguments

filename

The file to test for writable

prompt_text

If not writable, show this prompt text to the user

abort_answer

If the user enters this string into the prompt, this function will stop()

Details

Note: The file will not be overwritten or changed by this function.

Value

TRUE if writable, FALSE if aborted by user or (not-writeable and non-interactive)


cbielow/PTXQC documentation built on March 13, 2024, 5:08 a.m.