From 9be56ab786790d307b846686d28a8f78385f0ba2 Mon Sep 17 00:00:00 2001 From: FongMi Date: Wed, 17 May 2023 15:32:29 +0800 Subject: [PATCH] Fix file permission --- .../com/github/catvod/utils/FileUtil.java | 20 +++++++++++++------ jar/custom_spider.jar.md5 | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/github/catvod/utils/FileUtil.java b/app/src/main/java/com/github/catvod/utils/FileUtil.java index 44763249..78e38615 100644 --- a/app/src/main/java/com/github/catvod/utils/FileUtil.java +++ b/app/src/main/java/com/github/catvod/utils/FileUtil.java @@ -11,16 +11,12 @@ import java.io.InputStreamReader; public class FileUtil { - public static File getExternalCacheDir() { - return Init.context().getExternalCacheDir(); - } - public static File getCacheDir() { - return Init.context().getCacheDir(); + return Init.context().getExternalCacheDir(); } public static File getCacheFile(String fileName) { - return getExternalCacheDir().canWrite() ? new File(getExternalCacheDir(), fileName) : new File(getCacheDir(), fileName); + return new File(getCacheDir(), fileName); } public static void write(File file, String data) { @@ -33,8 +29,20 @@ public class FileUtil { fos.write(data); fos.flush(); fos.close(); + chmod(file); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static File chmod(File file) { + try { + Process process = Runtime.getRuntime().exec("chmod 777 " + file); + process.waitFor(); + return file; } catch (Exception e) { e.printStackTrace(); + return file; } } diff --git a/jar/custom_spider.jar.md5 b/jar/custom_spider.jar.md5 index 732b6b61..5749768e 100644 --- a/jar/custom_spider.jar.md5 +++ b/jar/custom_spider.jar.md5 @@ -1 +1 @@ -176b1654119d82e6231a4f6046f630e2 +d81491287f85debfc69e10a2ec775b4d