From 1a31d637867a5dec22d8ff2ba36111f7ed0b4a33 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 8 Jan 2024 15:09:17 +0900 Subject: [PATCH] =?UTF-8?q?Current=E3=81=AE=E7=A2=BA=E8=AA=8D=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processor/impl/DocumentProcessorImpl.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java index 8d21ad54..fb09864e 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java +++ b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java @@ -100,7 +100,15 @@ public class DocumentProcessorImpl implements DocumentProcessor{ String filename = UUID.randomUUID().toString() + ".png"; // TODO-rca: 拡張子を動的にする // FileManager - this.fileManager.autoCreateDir(DEFAULT_SAVE_DIR); + if (this.fileManager.getCurrentDir().equals(this.documentRootPath.resolve(DEFAULT_SAVE_DIR))) { // TODO-rca: 効率化 + logger.debug("addNewPageToLast", "currentDir is documentRootPath"); + } else { + logger.debug("addNewPageToLast", "currentDir is not documentRootPath"); + this.fileManager.backRootDir(); + this.fileManager.autoCreateDir(DEFAULT_SAVE_DIR); + this.fileManager.changeDir(DEFAULT_SAVE_DIR); + } + logger.debug("addNewPageToLast", "DirInit finished"); // Save file this.fileManager.saveBitmapAtCurrent(bitmap, filename); @@ -114,10 +122,11 @@ public class DocumentProcessorImpl implements DocumentProcessor{ @Override public void addNewPagesToLast(Bitmap[] bitmaps) { - logger.debug("addNewPagesToLast(List)", "called"); - for(Bitmap bitmap : bitmaps) { + logger.debug("addNewPagesToLast", "called"); + + for (Bitmap bitmap : bitmaps) { addNewPageToLast(bitmap); - } // TODO-rca: 保存処理をまとめて行う? + } // TODO-rca: 効率悪いので改善する } @Override