pull/123/head
FongMi 3 years ago
parent eaebcbf4c1
commit 99aee20159
  1. 2
      app/src/main/java/com/fongmi/android/tv/net/Download.java
  2. 4
      app/src/main/java/com/fongmi/android/tv/utils/FileUtil.java

@ -35,7 +35,7 @@ public class Download {
FileUtil.clearDir(file);
Response response = OkHttp.newCall(url).execute();
download(response.body().byteStream(), Double.parseDouble(response.header("Content-Length", "1")));
App.post(() -> callback.success(file));
App.post(() -> callback.success(FileUtil.chmod(file)));
} catch (Exception e) {
App.post(() -> callback.error(e.getMessage()));
}

@ -158,12 +158,14 @@ public class FileUtil {
App.get().startActivity(intent);
}
private static void chmod(File file) {
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;
}
}
}

Loading…
Cancel
Save