Fix jar load

pull/605/head
jhengazuji 5 months ago
parent b084ab5f12
commit f3ac694c84
  1. 1
      app/src/main/java/com/fongmi/android/tv/api/config/WallConfig.java
  2. 2
      app/src/main/java/com/fongmi/android/tv/api/loader/JarLoader.java
  3. 13
      catvod/src/main/java/com/github/catvod/utils/Path.java

@ -97,7 +97,6 @@ public class WallConfig {
}
private void download() throws Throwable {
Path.clear(FileUtil.getWall(0));
File file = FileUtil.getWall(0);
Path.clear(FileUtil.getWallCache());
if (getUrl().startsWith("file")) Path.copy(Path.local(getUrl()), file);

@ -47,7 +47,7 @@ public class JarLoader {
}
private void load(String key, File file) {
if (!file.setReadOnly()) return;
if (!Path.exists(file) || !file.setReadOnly()) return;
loaders.put(key, dex(file));
invokeInit(key);
putProxy(key);

@ -1,9 +1,9 @@
package com.github.catvod.utils;
import android.os.Environment;
import android.util.Log;
import com.github.catvod.Init;
import com.orhanobut.logger.Logger;
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -214,15 +214,16 @@ public class Path {
public static void clear(File dir) {
if (dir == null) return;
if (dir.isDirectory()) for (File file : list(dir)) clear(file);
if (dir.delete()) Log.d(TAG, "Deleted:" + dir.getAbsolutePath());
if (dir.delete()) Logger.t(TAG).d("Deleted:" + dir);
}
public static File create(File file) {
try {
if (file.getParentFile() != null) mkdir(file.getParentFile());
if (!file.canWrite()) file.setWritable(true);
if (!file.exists()) file.createNewFile();
Shell.exec("chmod 777 " + file);
File parent = file.getParentFile();
if (parent != null) mkdir(parent);
if (file.exists()) clear(file);
if (file.createNewFile()) Logger.t(TAG).d("Create:" + file);
if (file.setWritable(true)) Shell.exec("chmod 777 " + file);
return file;
} catch (IOException e) {
e.printStackTrace();

Loading…
Cancel
Save