From 2deda639a57e226f95ca8da11cf099792459fe6a Mon Sep 17 00:00:00 2001 From: katieb1 Date: Wed, 6 Dec 2023 15:31:10 -0800 Subject: [PATCH] Add error messages for datasheets w/o package prefixes --- R/datasheet.R | 10 ++-------- R/internalHelpers.R | 3 +-- R/saveDatasheet.R | 4 +--- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/R/datasheet.R b/R/datasheet.R index e753ec6f..5557c174 100644 --- a/R/datasheet.R +++ b/R/datasheet.R @@ -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 } } diff --git a/R/internalHelpers.R b/R/internalHelpers.R index 5e4c2db9..aa2f8528 100644 --- a/R/internalHelpers.R +++ b/R/internalHelpers.R @@ -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) diff --git a/R/saveDatasheet.R b/R/saveDatasheet.R index 72e79ea9..892182ab 100644 --- a/R/saveDatasheet.R +++ b/R/saveDatasheet.R @@ -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)) {