diff --git a/android/GT_APP/app/src/main/java/com/tencent/wstt/gt/analysis4/GTRDataToJsManager.java b/android/GT_APP/app/src/main/java/com/tencent/wstt/gt/analysis4/GTRDataToJsManager.java index 57b9d98..61a05a9 100644 --- a/android/GT_APP/app/src/main/java/com/tencent/wstt/gt/analysis4/GTRDataToJsManager.java +++ b/android/GT_APP/app/src/main/java/com/tencent/wstt/gt/analysis4/GTRDataToJsManager.java @@ -263,6 +263,24 @@ private static void toDataJs(File des) { private static void toDataJs() { File des = isWX ? new File(getResultDataFilePath) : new File(resultDataFilePath); - toDataJs(des); + if (toCreateFileDir(des)) { + toDataJs(des); + } else { + System.out.println("ErrorData: 文件创建失败,请开启系统读写权限后重试"); + } + } + + private static boolean toCreateFileDir(File des) { + try { + if (des.exists()) { + des.delete(); + } + des.getParentFile().mkdirs(); + des.createNewFile(); + return true; + } catch (IOException e) { + e.printStackTrace(); + return false; + } } }