From 6757117e0d89d7a468cfaf0d130f04ea9648a91d Mon Sep 17 00:00:00 2001 From: Gabriel <97042217+GabrielBRDeveloper@users.noreply.github.com> Date: Fri, 22 Dec 2023 15:40:10 -0400 Subject: [PATCH] Fix buffer errors --- .../java/com/panda3ds/pandroid/utils/FileUtils.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/utils/FileUtils.java b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/utils/FileUtils.java index 1f0cff07..c6902c94 100644 --- a/src/pandroid/app/src/main/java/com/panda3ds/pandroid/utils/FileUtils.java +++ b/src/pandroid/app/src/main/java/com/panda3ds/pandroid/utils/FileUtils.java @@ -64,16 +64,16 @@ public class FileUtils { public static boolean createFile(String path, String name) { DocumentFile folder = parseFile(path); - if (folder.findFile(name) != null) - return true; + if (folder.findFile(name) != null) { + folder.findFile(name).delete(); + } + return folder.createFile("", name) != null; } public static boolean writeTextFile(String path, String name, String content) { try { - if (!exists(path + "/" + name)) { - createFile(path, name); - } + createFile(path, name); OutputStream stream = getOutputStream(path + "/" + name); stream.write(content.getBytes(StandardCharsets.UTF_8)); stream.flush();