mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-31 05:07:51 -06:00
M4.11: packaging metadata describes a vector illustration app
Drop the file types and wording carried over from the sibling raster editor: the macOS exported type now declares .vectorcraft/.drawcraft (was .pcraft) and the raster imported types (large raster documents, QOI) are gone; the dev bundle's PDF type is "PDF Document"; Linux categories and keywords say vector graphics (no trademark keyword), the AppStream description and screenshot show VectorCraft, and the deb/rpm, MSI and web embedding descriptions say vector illustration app. File associations stay as they are. An xtask test rejects raster-editor wording in packaging/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
016fcbf34e
commit
0af38a31fd
+53
-7
@@ -21,8 +21,14 @@ pub fn run(root: &Path) -> Result<(), String> {
|
||||
std::fs::copy(target.join("release/vectorcraft"), app.join("MacOS/VectorCraft")).map_err(|e| format!("copy app: {e}"))?;
|
||||
std::fs::copy(target.join("release/vectorcraft-cli"), app.join("MacOS/vectorcraft-cli")).map_err(|e| format!("copy cli: {e}"))?;
|
||||
std::fs::copy(root.join("assets/app-icon/vectorcraft.icns"), app.join("Resources/VectorCraft.icns")).map_err(|e| format!("copy icon: {e}"))?;
|
||||
let version = env!("CARGO_PKG_VERSION");
|
||||
let plist = format!(
|
||||
std::fs::write(app.join("Info.plist"), info_plist(env!("CARGO_PKG_VERSION"))).map_err(|e| e.to_string())?;
|
||||
println!("built {}", root.join("dist/VectorCraft.app").display());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The development bundle's `Info.plist`.
|
||||
fn info_plist(version: &str) -> String {
|
||||
format!(
|
||||
r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0"><dict>
|
||||
@@ -39,12 +45,52 @@ pub fn run(root: &Path) -> Result<(), String> {
|
||||
<key>CFBundleDocumentTypes</key><array>
|
||||
<dict><key>CFBundleTypeName</key><string>VectorCraft Document</string><key>CFBundleTypeExtensions</key><array><string>vectorcraft</string></array><key>CFBundleTypeRole</key><string>Editor</string></dict>
|
||||
<dict><key>CFBundleTypeName</key><string>SVG</string><key>CFBundleTypeExtensions</key><array><string>svg</string></array><key>CFBundleTypeRole</key><string>Editor</string></dict>
|
||||
<dict><key>CFBundleTypeName</key><string>PDF / Illustrator</string><key>CFBundleTypeExtensions</key><array><string>pdf</string><string>ai</string></array><key>CFBundleTypeRole</key><string>Viewer</string></dict>
|
||||
<dict><key>CFBundleTypeName</key><string>PDF Document</string><key>CFBundleTypeExtensions</key><array><string>pdf</string><string>ai</string></array><key>CFBundleTypeRole</key><string>Viewer</string></dict>
|
||||
</array>
|
||||
</dict></plist>
|
||||
"#
|
||||
);
|
||||
std::fs::write(app.join("Info.plist"), plist).map_err(|e| e.to_string())?;
|
||||
println!("built {}", root.join("dist/VectorCraft.app").display());
|
||||
Ok(())
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// File types and wording a raster image editor's packaging carries (lowercase).
|
||||
const RASTER_EDITOR: &[&str] = &["pcraft", "psd", "psb", "qoi", "photo", "rastergraphics", "image editor"];
|
||||
|
||||
fn text_files(dir: &Path, out: &mut Vec<(String, String)>) {
|
||||
for e in std::fs::read_dir(dir).unwrap().flatten() {
|
||||
let p = e.path();
|
||||
if p.is_dir() {
|
||||
text_files(&p, out);
|
||||
} else if let Ok(t) = std::fs::read_to_string(&p) {
|
||||
out.push((p.display().to_string(), t.to_ascii_lowercase()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn packaging_describes_a_vector_app() {
|
||||
let mut files = vec![];
|
||||
text_files(&crate::root().join("packaging"), &mut files);
|
||||
assert!(files.len() > 5, "packaging files found");
|
||||
for (path, text) in &files {
|
||||
for w in RASTER_EDITOR {
|
||||
assert!(!text.contains(w), "{path} mentions `{w}`");
|
||||
}
|
||||
}
|
||||
let read = |p: &str| std::fs::read_to_string(crate::root().join(p)).unwrap();
|
||||
let plist = read("packaging/macos/Info.plist.in");
|
||||
assert!(plist.contains("<array><string>vectorcraft</string><string>drawcraft</string></array>"), "native format extensions");
|
||||
assert!(read("packaging/linux/ai.storyteller.vectorcraft.desktop").contains("Categories=Graphics;2DGraphics;VectorGraphics;"));
|
||||
assert!(read("packaging/linux/ai.storyteller.vectorcraft.metainfo.xml.in").contains("<category>VectorGraphics</category>"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dev_bundle_plist_names_types_neutrally() {
|
||||
let p = info_plist("1.2.3");
|
||||
assert!(p.contains("<key>CFBundleShortVersionString</key><string>1.2.3</string>"));
|
||||
assert!(p.contains("<string>VectorCraft Document</string>") && p.contains("<string>PDF Document</string>"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user