Skip to content

Locate Tau-Argus via TAUARGUS_EXE (.Renviron), auto-detection or file chooser - #70

Open
szimmer wants to merge 2 commits into
InseeFrLab:masterfrom
szimmer:tauargus-exe-renviron
Open

szimmer wants to merge 2 commits into
InseeFrLab:masterfrom
szimmer:tauargus-exe-renviron

Conversation

@szimmer

@szimmer szimmer commented Nov 4, 2026

Copy link
Copy Markdown

Summary

The package currently initialises rtauargus.tauargus_exe to Y:/Logiciels/TauArgus/TauArgus.exe, a path that only exists on INSEE workstations, and the vignettes and examples hard-code that folder layout. This PR replaces it with a configuration approach similar to how API keys are usually handled in R packages (e.g. tidycensus::census_api_key()).

How the location of Tau-Argus is now found

  1. The TAUARGUS_EXE environment variable, typically set once in .Renviron.
  2. A TAUARGUS_EXE entry in the user .Renviron file (useful if it was added during the current session).
  3. Auto-detection: TauArgus on the PATH, then TauArgus.exe inside folders whose name contains "Argus" (up to three levels deep) in the usual locations: Program Files, %LOCALAPPDATA%, the user folder and its Downloads folder, and the root of the system drive. If several versions are found, the highest version number in the path wins. The search takes a few hundredths of a second.
  4. Interactive prompt: if run_arb() still cannot find Tau-Argus in an interactive session, a file chooser opens (RStudio's if available, otherwise the Windows dialog or file.choose()) and the user is asked whether to save the choice in .Renviron. Non-interactive sessions get an explicit error explaining how to set it.

options(rtauargus.tauargus_exe = ...) and the tauargus_exe argument of run_arb() still work as before.

New exported functions

  • set_tauargus_exe(path, install = FALSE, overwrite = FALSE, check = TRUE): sets the location for the session, or saves it in .Renviron with install = TRUE (a .Renviron.bak backup is made first).
  • get_tauargus_exe(detect = TRUE): returns the location currently in use.

Validation

  • A path is only accepted if it is an existing file (file.exists() alone also accepts folders). A folder gets an explicit error suggesting the TauArgus.exe path inside it.
  • set_tauargus_exe() stops on a missing file or a folder (check = FALSE stores it anyway, e.g. for a network drive that is not connected yet).
  • If TAUARGUS_EXE points to a file that no longer exists (e.g. after upgrading Tau-Argus), the automatic search is used instead, with a message explaining how to update it.

Documentation and vignettes

  • The startup message, run_arb() errors, ?rtauargus_options, ?run_arb, README, NEWS and the \dontrun{} examples now use set_tauargus_exe("C:/path/to/TauArgus/TauArgus.exe") instead of the Y:/ path.
  • Vignettes (EN and FR, .Rmd.orig and precompiled .Rmd) describe the new setup, and the affected HTML vignettes are re-rendered.
  • For precompilation: the setup chunks in the .Rmd.orig files are now eval = FALSE, so precompilation.R uses the maintainer's own TAUARGUS_EXE (set it in .Renviron before precompiling) rather than a placeholder path.
  • Also fixes a broken chunk fence (two backticks instead of three) in protect_multi_tables_fr, which made a whole section ("Comment protéger 4 tableaux liés en même temps") render as raw code.

Dependencies

rstudioapi (file chooser in RStudio) and withr (test cleanup) are added to Suggests.

Tests

New tests/testthat/test_tauargus_exe.R (38 expectations) covering detection, version ordering, priority order, stale paths, folder rejection, .Renviron writing/overwrite, and the interactive prompt (mocked). The full test suite passes.

Note

This overlaps with files touched by #69 (documentation cleanup), so whichever is merged second will likely need a rebase. Happy to rebase this one if #69 goes in first.

🤖 Generated with Claude Code

szimmer and others added 2 commits November 4, 2026 16:15
Replace the hard-coded "Y:/Logiciels/TauArgus/TauArgus.exe" default with:

- the TAUARGUS_EXE environment variable, typically set in .Renviron;
- new exported helpers set_tauargus_exe() (session or .Renviron with
  install = TRUE) and get_tauargus_exe();
- automatic detection when not set (PATH, then "Argus" folders in the
  usual install locations, most recent version first);
- an interactive file chooser in run_arb() when Tau-Argus still cannot
  be found, with an offer to save the choice in .Renviron.

Update the startup message, run_arb() errors, docs, README, NEWS and
vignettes (no more user-specific paths; setup chunks are eval = FALSE so
precompilation uses the maintainer's own TAUARGUS_EXE). Also fix a broken
chunk fence in protect_multi_tables_fr that rendered a whole section as
raw code. Re-render the affected HTML vignettes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Shared check (non-empty, exists, not a folder) used by run_arb(),
  get_tauargus_exe() and the startup message; folders get an explicit
  error suggesting the TauArgus.exe path inside.
- set_tauargus_exe() stops on a missing file or a folder instead of
  warning; check = FALSE stores the path anyway (e.g. network drive).
- If TAUARGUS_EXE points to a missing file, fall back to auto-detection
  with a message explaining how to update it; if nothing is detected,
  keep the stored path so errors and the file chooser refer to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant