This commit is contained in:
r-ca 2024-01-08 11:23:06 +09:00
parent 552f0e42b5
commit 49775a1f49
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -2,6 +2,7 @@ package one.nem.lacerta.processor.impl;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import java.io.File;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
@ -56,7 +57,7 @@ public class DocumentProcessorImpl implements DocumentProcessor{
logger.debug("init", "called"); logger.debug("init", "called");
// XMLメタデータの取得/生成 // XMLメタデータの取得/生成
FileManager fileManager = fileManagerFactory.create(documentDetail.getPath().getFullPath()); FileManager fileManager = fileManagerFactory.create(documentDetail.getPath().getFullPath());
if(fileManager.getList().contains(documentDetail.getPath().getFullPath().resolve("meta.xml"))) { if(documentDetail.getPath().getFullPath().resolve("meta.xml").toFile().exists()) {
logger.debug("init", "meta.xml found"); logger.debug("init", "meta.xml found");
try { try {
xmlMetaModel = xmlMetaParser.parse(new String(Files.readAllBytes(documentDetail.getPath().getFullPath().resolve("meta.xml")))); xmlMetaModel = xmlMetaParser.parse(new String(Files.readAllBytes(documentDetail.getPath().getFullPath().resolve("meta.xml"))));
@ -77,6 +78,11 @@ public class DocumentProcessorImpl implements DocumentProcessor{
// Save // Save
try { try {
// ファイルの新規作成を行う
File file = documentDetail.getPath().getFullPath().resolve("meta.xml").toFile();
file.createNewFile();
// ファイルに書き込む
Files.write(documentDetail.getPath().getFullPath().resolve("meta.xml"), xmlMetaParser.serialize(xmlMetaModel).getBytes()); Files.write(documentDetail.getPath().getFullPath().resolve("meta.xml"), xmlMetaParser.serialize(xmlMetaModel).getBytes());
logger.debug("init", "saved"); logger.debug("init", "saved");
} catch (Exception e) { } catch (Exception e) {