Skip to content
This repository was archived by the owner on Dec 29, 2025. It is now read-only.

Commit ee2b2ec

Browse files
authored
Update FileUtils.java
1 parent ae6feb3 commit ee2b2ec

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

src/main/java/id.my.alvinq.prokitid.libs/FileUtils.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@
88
import java.io.PrintWriter;
99
import java.io.StringWriter;
1010
import java.lang.reflect.InvocationTargetException;
11-
import android.content.Context;
1211

1312
public class FileUtils {
14-
private static Context context;
15-
public FileUtils(Context ctx) {
16-
context = ctx;
17-
}
1813
public static String getStackTraceAsString(Throwable th) {
1914
StringWriter sw = new StringWriter();
2015
PrintWriter pw = new PrintWriter(sw);
@@ -23,13 +18,10 @@ public static String getStackTraceAsString(Throwable th) {
2318
}
2419
public static void copyFile(String from, String to) {
2520
try {
26-
Files.copy(Paths.get(from), Paths.get(to), StandardCopyOption.REPLACE_EXISTING);
21+
Files.copy(Paths.get(from), Paths.get(to), StandardCopyOption.REPLACE_EXISTING);
2722
} catch (Exception e) {
28-
Throwable real = (e instanceof InvocationTargetException)
29-
? ((InvocationTargetException) e).getCause()
30-
: e;
23+
Throwable real = (e instanceof InvocationTargetException) ? ((InvocationTargetException) e).getCause() : e;
3124
String errorLog = getStackTraceAsString(real);
32-
Toast.makeText(context, errorLog, Toast.LENGTH_LONG).show();
3325
Logger.get().error("Error!: " + errorLog);
3426
}
3527
}
@@ -56,12 +48,9 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
5648
}
5749
});
5850
} catch (Exception e) {
59-
Throwable real = (e instanceof InvocationTargetException)
60-
? ((InvocationTargetException) e).getCause()
61-
: e;
51+
Throwable real = (e instanceof InvocationTargetException) ? ((InvocationTargetException) e).getCause() : e;
6252
String errorLog = getStackTraceAsString(real);
63-
Toast.makeText(context, errorLog, Toast.LENGTH_LONG).show();
6453
Logger.get().error("Error!: " + errorLog);
65-
}
54+
}
6655
}
6756
}

0 commit comments

Comments
 (0)