mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-01 14:07:34 -06:00
This commit is contained in:
@@ -445,7 +445,10 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
let mut r = json!({"keywords": file.written.len(), "captureOneRefuses": refuses, "unwritable": file.unwritable});
|
||||
match str_param(p, "path").map(str::trim).filter(|x| !x.is_empty()) {
|
||||
Some(path) => {
|
||||
std::fs::write(path, &file.text).map_err(|e| crate::EngineError::Other(format!("{path}: {e}")))?;
|
||||
s.check_write_target(path).map_err(|e| bad("keyword.export", e))?;
|
||||
// A folder that isn't there is an error, not created.
|
||||
lightcraft_catalog::safe_file::write_atomic(std::path::Path::new(path), file.text.as_bytes())
|
||||
.map_err(|e| crate::EngineError::Other(format!("{path}: {e}")))?;
|
||||
r["path"] = json!(path);
|
||||
}
|
||||
None => r["text"] = json!(file.text),
|
||||
|
||||
Reference in New Issue
Block a user