feat(kc): Layer 1 — C++ format registration (.kc file dialogs, MIME type, demotion) #44
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Register
.kcas a first-class file type in FreeCAD's C++ application framework. This enables.kcto appear in open/save dialogs, be the default format for new documents, and be associated with Kindred Create at the OS level.Currently
.kcfiles open only because FreeCAD treats any ZIP file as a potential.fcstd. This works but is fragile — there is no formal registration, no file dialog support, and no Save As →.fcstddemotion that stripssilo/data.Scope
src/App/Application.cpp.kcextension alongside.fcstdin the file type mapopenDocument()path (identical ZIP internals)doc.FileNamepreserves the.kcextension after opensrc/Gui/FileDialog.cpp.kcto Open dialog filter:"Kindred Create (*.kc);;FreeCAD (*.fcstd);;All Files (*)".kcto Save/Save As dialog with.kcas the default for new documentssrc/App/Document.cpp(or post-save hook).fcstd(demotion): After FreeCAD writes the ZIP, strip the entiresilo/directory from the archive and remove any Silo object stubs fromDocument.xml. The result must be a clean vanilla.fcstd..kc(promotion): Ifsilo/manifest.jsondoes not exist, create it with default values (new UUID, timestamps, creator username).Platform integration
.desktopfile withMimeType=application/x-kindred-createand XDG MIME type definition XMLInfo.plistUTI declaration:com.kindred-systems.create.document, document type association for.kc.kcfile association, icon assignmentMIME type definition
.kcapplication/x-kindred-createcom.kindred-systems.create.documentPK(ZIP header) +silo/manifest.jsonentry presentTechnical notes
.kc→.fcstd) must run after FreeCAD's own save completes, since FreeCAD writes the ZIP first. Either hooksignalSaveDocumentor perform post-write ZIP manipulation..fcstd→.kc) can be handled bykc_format.py's existing manifest creation logic, but the C++ layer should ensure the extension change is recognized by the file dialog.silo/survives normal saves. The demotion path is the only case where active removal is needed.Acceptance criteria
.kcfiles appear in the Open dialog filter and can be selected.kcextension on Save.fcstdwith nosilo/directory and no Silo object stubs inDocument.xml.fcstdcreatessilo/manifest.jsonwith a new UUID.kcfile on Linux opens Kindred Create.kcfile on macOS opens Kindred Create.kcfile on Windows opens Kindred Create.kcfiles show the Kindred Create document icon in file browsersDependencies
References
docs/KC_SPECIFICATION.md§5 (Interoperability), §6 Layer 1, Appendix A (MIME type)