diff --git a/src/components/views/PckEditorView.tsx b/src/components/views/PckEditorView.tsx index 96f8630..cc373f2 100644 --- a/src/components/views/PckEditorView.tsx +++ b/src/components/views/PckEditorView.tsx @@ -5,7 +5,6 @@ import { PckService } from "../../services/PckService"; import { PCKFile, PCKAsset, PCKAssetType } from "../../types/pck"; import SkinPreview3D from "../common/SkinPreview3D"; import { TauriService } from "../../services/TauriService"; - export default function PckEditorView() { const { setActiveView } = useUI(); const { playPressSound, playBackSound } = useAudio(); @@ -22,7 +21,6 @@ export default function PckEditorView() { const containerRef = useRef(null); const replaceInputRef = useRef(null); const addAssetInputRef = useRef(null); - const treeData = useMemo(() => { if (!pck) return []; interface TempNode { @@ -359,17 +357,9 @@ export default function PckEditorView() { if (!baseFolder) return; playPressSound(); showNotification("Exporting all assets..."); - for (const asset of pck.files) { const parts = asset.path.split("/"); let currentPath = baseFolder; - - // This won't work easily if we need to create subdirectories, - // normally we should tell the backend to write with directory creation - // but for now let's hope writeBinaryFile handles it if we pass the full path - // Actually, write_binary_file in lib.rs uses fs::write which doesn't create parents. - // I'll update write_binary_file in lib.rs later if needed. - // For now let's just write to the flat folder with the filename. const fileName = parts.join("_"); await TauriService.writeBinaryFile(`${baseFolder}/${fileName}`, asset.data); } @@ -384,13 +374,12 @@ export default function PckEditorView() { playPressSound(); const buffer = PckService.serializePCK(pck); const data = new Uint8Array(buffer); - try { let targetPath = openedPath; if (!targetPath) { targetPath = await TauriService.saveFileDialog("Save PCK", pck.files.length > 0 ? "new.pck" : "empty.pck", ["pck"]); } - + if (targetPath) { await TauriService.writeBinaryFile(targetPath, data); setOpenedPath(targetPath); @@ -486,8 +475,8 @@ export default function PckEditorView() {
Endianness: -
XML Support: -