File tree 2 files changed +13
-12
lines changed
lib/utilcode/src/main/java/com/blankj/utilcode/util
2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 1
- * ` 20/04/08 ` [ fix] CleanUtils clean dir not work. Publish v1.27.4.
1
+ * ` 20/04/08 ` [ fix] CleanUtils clean dir not work. FileUtils#isFileExists. Publish v1.27.4.
2
2
* ` 20/04/08 ` [ fix] CrashUtils DefaultUncaughtExceptionHandler is wrong; LogUtils write file failed; Utils#getApp failed run on remote process. Publish v1.27.3.
3
3
* ` 20/04/07 ` [ mdf] GsonUtils#getGson() method public.
4
4
* ` 20/04/04 ` [ fix] ShadowUtils bug running on lower version devices. Publish v1.27.2.
Original file line number Diff line number Diff line change @@ -50,6 +50,16 @@ public static File getFileByPath(final String filePath) {
50
50
return UtilsBridge .isSpace (filePath ) ? null : new File (filePath );
51
51
}
52
52
53
+ /**
54
+ * Return whether the file exists.
55
+ *
56
+ * @param file The file.
57
+ * @return {@code true}: yes<br>{@code false}: no
58
+ */
59
+ public static boolean isFileExists (final File file ) {
60
+ return file != null && isFileExists (file .getAbsolutePath ());
61
+ }
62
+
53
63
/**
54
64
* Return whether the file exists.
55
65
*
@@ -58,7 +68,8 @@ public static File getFileByPath(final String filePath) {
58
68
*/
59
69
public static boolean isFileExists (final String filePath ) {
60
70
if (Build .VERSION .SDK_INT < 29 ) {
61
- return isFileExists (getFileByPath (filePath ));
71
+ File file = getFileByPath (filePath );
72
+ return file != null && file .exists ();
62
73
}
63
74
return isFileExists29 (filePath );
64
75
}
@@ -79,16 +90,6 @@ private static boolean isFileExists29(String filePath) {
79
90
return true ;
80
91
}
81
92
82
- /**
83
- * Return whether the file exists.
84
- *
85
- * @param file The file.
86
- * @return {@code true}: yes<br>{@code false}: no
87
- */
88
- public static boolean isFileExists (final File file ) {
89
- return file != null && file .exists ();
90
- }
91
-
92
93
/**
93
94
* Rename the file.
94
95
*
You can’t perform that action at this time.
0 commit comments