Skip to content

Commit

Permalink
Add error messages for datasheets w/o package prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
katieb1 committed Dec 6, 2023
1 parent 6f17788 commit 2deda63
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
10 changes: 2 additions & 8 deletions R/datasheet.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,9 @@ setMethod("datasheet",
for (i in seq_along(name)) {
n <- name[i]
if (!grepl("_", n, fixed = TRUE)) {
l = ssimLibrary(.filepath(ssimObject), summary=T)
p = l$value[l$property == "Package Names:"][1] #TODO: test
n <- paste0(p, "_", n)
}

if (grepl("STSim_", n, fixed = TRUE)) {
warning("An STSim_ prefix for a datasheet name is no longer required.")
n <- paste0("stsim_", gsub("STSim_", "", n, fixed = TRUE))
stop("The datasheet name requires a package prefix (e.g., 'stsim_RunControl')")
}

name[i] <- n
}
}
Expand Down
3 changes: 1 addition & 2 deletions R/internalHelpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ deleteDatasheet <- function(x, datasheet, datasheets, cProj = NULL, cScn = NULL,
cName <- datasheet[j]

if (!grepl("_", cName, fixed = TRUE)) {
pkg = lib$value[lib$property == "Package Names:"][1]
cName <- paste0(pkg, "_", cName)
stop("The datasheet name requires a package prefix (e.g., 'stsim_RunControl')")
}

cSheet <- subset(datasheets, name == cName)
Expand Down
4 changes: 1 addition & 3 deletions R/saveDatasheet.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ setMethod("saveDatasheet", signature(ssimObject = "SsimObject"), function(ssimOb
}

if (!grepl("_", name, fixed = )) {
l = ssimLibrary(.filepath(ssimObject), summary=T)
p = l$value[l$property == "Package Name:"][1] #TODO: test
name <- paste0(p, "_", name)
stop("The datasheet name requires a package prefix (e.g., 'stsim_RunControl')")
}

if (grepl("STSim_", name, fixed = TRUE)) {
Expand Down

0 comments on commit 2deda63

Please sign in to comment.