ログ追加, 保存場所が異常になる問題を修正

This commit is contained in:
r-ca 2024-01-09 15:52:47 +09:00
parent 36ecb3ab13
commit 9065ee1e1f
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -52,7 +52,7 @@ public class FileManagerImpl implements FileManager {
// Internal // Internal
private Path resolveStringPath(String path) throws IOException{ private Path resolveStringPath(String path) throws IOException{
String[] pathArray = path.split("/"); String[] pathArray = path.split("/");
Path resolvedPath = this.rootDir; Path resolvedPath = this.path;
for (String pathPart : pathArray) { for (String pathPart : pathArray) {
if (pathPart.equals("..")) { if (pathPart.equals("..")) {
resolvedPath = resolvedPath.getParent(); resolvedPath = resolvedPath.getParent();
@ -71,6 +71,7 @@ public class FileManagerImpl implements FileManager {
private FileManager newInstance(Path rootDir, Path path, boolean autoCreateParent, boolean disableRootDirCheck) { private FileManager newInstance(Path rootDir, Path path, boolean autoCreateParent, boolean disableRootDirCheck) {
logger.debug("newInstance", "Generating new instance"); logger.debug("newInstance", "Generating new instance");
logger.debug("newInstance", "Path: " + path);
return new FileManagerImpl(this.logger, rootDir, path, autoCreateParent, disableRootDirCheck); return new FileManagerImpl(this.logger, rootDir, path, autoCreateParent, disableRootDirCheck);
} }
@ -173,6 +174,7 @@ public class FileManagerImpl implements FileManager {
throw new IllegalArgumentException("path must be in rootDir"); throw new IllegalArgumentException("path must be in rootDir");
} }
} }
logger.debug("setPath", "resolvedPath: " + resolvedPath);
return this.newInstance(this.rootDir, resolvedPath, this.autoCreateParent, this.disableRootDirCheck); return this.newInstance(this.rootDir, resolvedPath, this.autoCreateParent, this.disableRootDirCheck);
} }
@ -292,6 +294,7 @@ public class FileManagerImpl implements FileManager {
} }
private void saveBitmapInternal(Bitmap bitmap, Path path) throws IOException { private void saveBitmapInternal(Bitmap bitmap, Path path) throws IOException {
try { try {
logger.debug("saveBitmapInternal", "path: " + path);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, Files.newOutputStream(path)); bitmap.compress(Bitmap.CompressFormat.PNG, 100, Files.newOutputStream(path));
} catch (Exception e) { } catch (Exception e) {
logger.error("saveBitmapInternal", e.getMessage()); logger.error("saveBitmapInternal", e.getMessage());