Added listing of files

This commit is contained in:
Waldir Leoncio 2020-05-20 13:09:11 +02:00
parent ee57a98589
commit 3962c8c0e8
2 changed files with 10 additions and 2 deletions

View file

@ -2,9 +2,10 @@
#' @description Loosely mimics the functionality of the `uigetfile` function on
#' Matlab.
#' @references https://se.mathworks.com/help/matlab/ref/uigetfile.html
#' @param filter Filter listed files
#' @param title Pre-prompt message
#' @export
uigetfile <- function(title = "") {
uigetfile <- function(filter = "", title = "") {
# ==========================================================================
# Pre-prompt message
# ==========================================================================
@ -16,6 +17,11 @@ uigetfile <- function(title = "") {
paste0("Enter file path (leave empty for ", getwd(), "): ")
)
if (filepath == "") filepath <- getwd()
# ==========================================================================
# Presenting possible files
# ==========================================================================
message("Files present on that directory:")
print(list.files(path = filepath, pattern = filter, ignore.case = TRUE))
filename <- file.choose()
# ==========================================================================
# Organizing output

View file

@ -4,9 +4,11 @@
\alias{uigetfile}
\title{Select a file for loading}
\usage{
uigetfile(title = "")
uigetfile(filter = "", title = "")
}
\arguments{
\item{filter}{Filter listed files}
\item{title}{Pre-prompt message}
}
\description{