mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-13 13:52:34 +00:00
Keep library links working when the project folder is moved or cloned (#2132)
Fixes #2122 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39acc36438
commit
7b34dbab00
13 files changed
+201
-10
No files matched your search
@@ -464,7 +464,7 @@ pub fn run_script(script: &str, input: Option<&str>, out: Option<&str>) -> CliRe
|
||||
refuse_dropping_images_from_script(input.map(|input| (input, input_images_left_out)), ds, out)?;
|
||||
if ext(out) == "figcraft" {
|
||||
// Through the engine, so the version history is kept.
|
||||
write(out, &figcraft_engine::cmd::file::file_bytes(ds).map_err(|e| CliError::Failed(e.to_string()))?)?;
|
||||
write(out, &figcraft_engine::cmd::file::file_bytes_at(ds, out).map_err(|e| CliError::Failed(e.to_string()))?)?;
|
||||
} else {
|
||||
write_doc(&ds.doc, ds.page, out)?;
|
||||
}
|
||||
|
||||
@@ -508,7 +508,13 @@ fn measure_components(table: &mut Table, col: usize, instances: usize) -> CliRes
|
||||
let lib = figcraft_engine::library::Cache::default().load(&path).map_err(failed)?;
|
||||
let mut doc = Document::new("Consumer");
|
||||
let m = &lib.manifest;
|
||||
doc.libraries_mut().enabled.push(figcraft_doc::LibraryLink { id: m.id.clone(), name: m.name.clone(), path: path.clone(), version: m.version });
|
||||
doc.libraries_mut().enabled.push(figcraft_doc::LibraryLink {
|
||||
id: m.id.clone(),
|
||||
name: m.name.clone(),
|
||||
path: path.clone(),
|
||||
version: m.version,
|
||||
..Default::default()
|
||||
});
|
||||
let map = figcraft_engine::library::import(&mut doc, &lib, &lib_ds.assets(), false).map_err(failed)?;
|
||||
let mut local = lib_ds.remap(&map);
|
||||
local.theme = doc.libraries.collections.iter().find(|r| r.key == lib_ds.theme).map(|r| r.local.clone()).unwrap_or_default();
|
||||
|
||||
Reference in new issue
Block a user