about summary refs log tree commit diff stats
path: root/082persist.cc
diff options
context:
space:
mode:
Diffstat (limited to '082persist.cc')
-rw-r--r--082persist.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/082persist.cc b/082persist.cc
index 3e53ff6a..f10b44a2 100644
--- a/082persist.cc
+++ b/082persist.cc
@@ -13,14 +13,18 @@ case RESTORE: {
     raise << current_recipe_name() << ": 'restore' requires exactly one ingredient, but got " << current_instruction().to_string() << '\n' << end();
     break;
   }
-  if (!scalar(ingredients.at(0))) {
-    raise << current_recipe_name() << ": first ingredient of 'restore' should be a literal string, but got " << current_instruction().ingredients.at(0).to_string() << '\n' << end();
+  string filename;
+  if (is_literal_string(current_instruction().ingredients.at(0))) {
+    filename = current_instruction().ingredients.at(0).name;
+  }
+  else if (is_mu_string(current_instruction().ingredients.at(0))) {
+    filename = read_mu_string(ingredients.at(0).at(0));
+  }
+  else {
+    raise << current_recipe_name() << ": first ingredient of 'restore' should be a string, but got " << current_instruction().ingredients.at(0).to_string() << '\n' << end();
     break;
   }
   if (Current_scenario) break;  // do nothing in tests
-  string filename = current_instruction().ingredients.at(0).name;
-  if (!is_literal(current_instruction().ingredients.at(0)))
-    filename = to_string(ingredients.at(0).at(0));
   string contents = slurp("lesson/"+filename);
   if (contents.empty())
     products.at(0).push_back(0);
'n125' href='#n125'>125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154