mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-14 14:22:39 +00:00
Format shared registry dispatch
This commit is contained in:
2 files changed
+7
-3
No files matched your search
@@ -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}")))?;
|
||||
|
||||
@@ -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)?;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user