Format shared registry dispatch

This commit is contained in:
Dylan M. Taylor committed 2026-11-13 01:45:29 -05:00
1 parent 44fd4aec60
commit 3028b5328c
2 files changed
+7 -3

No files matched your search

+5 -1
View File
@@ -130,7 +130,11 @@ impl ChapterBatch {
fn writable_chapter(s: &Session, path: &str, command: &'static str) -> Result<()> {
use std::path::Path;
if Path::new(path).extension().and_then(std::ffi::OsStr::to_str).is_some_and(|ext| craft_file_formats::from_extension(ext) == Some(craft_file_formats::Format::Idml)) {
if Path::new(path)
.extension()
.and_then(std::ffi::OsStr::to_str)
.is_some_and(|ext| craft_file_formats::from_extension(ext) == Some(craft_file_formats::Format::Idml))
{
return Err(bad(command, format!("cannot change imported IDML chapter {path}; convert it to a native DesignCraft document first")));
}
let target = crate::io::canonicalize(path).map_err(|e| EngineError::Other(format!("{path}: {e}")))?;
+2 -2
View File
@@ -139,8 +139,8 @@ impl DesignApp {
}
let layout = opens_as_document(&file.name)
|| (std::path::Path::new(&file.name).extension().is_none() && designcraft_engine::cmd::is_document(&file.bytes));
let place =
file.request.purpose == "place" || (matches!(file.request.purpose.as_str(), "drop" | "open") && !layout && format != Some(craft_file_formats::Format::Ase));
let place = file.request.purpose == "place"
|| (matches!(file.request.purpose.as_str(), "drop" | "open") && !layout && format != Some(craft_file_formats::Format::Ase));
if place || format == Some(craft_file_formats::Format::Ase) || file.request.purpose == "swatches" {
self.activate_import_target(&file.request)?;
}