Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
MLopez-Ibanez committed Jan 6, 2024
1 parent 5f5c585 commit 7ad6db7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions R/multi_irace.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ multi_irace <- function(scenarios, parameters, n = 1L, parallel = 1, split_outpu
# 'path/to/execDir' -> 'path/to/execDir/run_{i}'.
execDir <- file.path(execDir_old, sprintf("run_%02d", i))
scenarios[[i]]$execDir <- execDir
if (!dir.exists(execDir)) dir.create(execDir, recursive = TRUE)
fs::dir_create(execDir)

if (logFile_old != '') {
logFile <- if (is.sub.path(logFile_old, execDir_old)) {
Expand All @@ -82,7 +82,7 @@ multi_irace <- function(scenarios, parameters, n = 1L, parallel = 1, split_outpu
# pathExt <- tools::file_ext(logFile_old)
# pathWithoutExtWithIndex <- sprintf("%s_%02d", pathWithoutExt, i)
# paste(pathWithoutExtWithIndex, pathExt, sep = ".")
irace.error("Invalid 'logFile' path: ", "The 'logFile' must be located inside the 'execDir'.")
irace.error("Invalid 'logFile' path (", logFile_old, "): ", "The 'logFile' must be located inside the 'execDir' (", execDir_old, ").")
}
scenarios[[i]]$logFile <- logFile
}
Expand Down
10 changes: 5 additions & 5 deletions R/path_rel2abs.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#' Converts a relative path to an absolute path.
#'
#' It tries really hard to create canonical paths. If the path passed
#' corresponds to an executable, it tries to find its path using `Sys.which()`.
#' Expansion of `'~'` in Windows follows the definition of `fs::path_expand()`
#' rather than `base::path.expand()`.
#' If the path passed corresponds to an executable, it tries to find its path
#' using [Sys.which()]. Expansion of `'~'` in Windows follows the definition
#' of [fs::path_expand()] rather than [base::path.expand()]. This function
#' tries really hard to create canonical paths.
#'
#' @param path (`character(1)`) Character string representing a relative path.
#' @param cwd (`character(1)`) Current working directory.
Expand Down Expand Up @@ -31,5 +31,5 @@ path_rel2abs <- function (path, cwd = getwd())
path <- as.vector(sys_path)
}
}
fs::path_abs(path, start = cwd)
as.character(fs::path_abs(path, start = cwd))
}
11 changes: 5 additions & 6 deletions man/path_rel2abs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7ad6db7

Please sign in to comment.