Removes stale lock directories that can prevent package installation.
Lock files are created during package installation and should be automatically removed when installation completes. If installation is interrupted (e.g., by closing R or a crash), these lock files may remain and block future installations.
Usage
clean_lock_files(package = "factoextra", lib = .libPaths()[1], ask = TRUE)Value
Invisibly returns TRUE only when every discovered lock
directory is removed. Returns FALSE when no lock directories are
found, removal is declined, or any removal fails.
Examples
# Use a temporary library so the example cannot affect installed packages.
example_lib <- tempfile("factoextra-lock-example-")
example_lock <- file.path(example_lib, "00LOCK-factoextra")
dir.create(example_lock, recursive = TRUE)
clean_locks <- getFromNamespace("clean_lock_files", "factoextra")
clean_locks(lib = example_lib, ask = FALSE)
#> Found lock directories:
#> /var/folders/xm/8p6yj4bj6s57n4v_51714lwm0000gp/T//RtmpbroqEU/factoextra-lock-example-f75917ca76b0/00LOCK-factoextra
#> Removed: /var/folders/xm/8p6yj4bj6s57n4v_51714lwm0000gp/T//RtmpbroqEU/factoextra-lock-example-f75917ca76b0/00LOCK-factoextra
#> Lock files cleaned up successfully.
#> You can now reinstall the package.
stopifnot(!dir.exists(example_lock))
unlink(example_lib, recursive = TRUE)
