File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
lib/utilcode/src/main/java/com/blankj/utilcode/util Expand file tree Collapse file tree 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.
22* ` 20/04/08 ` [ fix] CrashUtils DefaultUncaughtExceptionHandler is wrong; LogUtils write file failed; Utils#getApp failed run on remote process. Publish v1.27.3.
33* ` 20/04/07 ` [ mdf] GsonUtils#getGson() method public.
44* ` 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) {
5050 return UtilsBridge .isSpace (filePath ) ? null : new File (filePath );
5151 }
5252
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+
5363 /**
5464 * Return whether the file exists.
5565 *
@@ -58,7 +68,8 @@ public static File getFileByPath(final String filePath) {
5868 */
5969 public static boolean isFileExists (final String filePath ) {
6070 if (Build .VERSION .SDK_INT < 29 ) {
61- return isFileExists (getFileByPath (filePath ));
71+ File file = getFileByPath (filePath );
72+ return file != null && file .exists ();
6273 }
6374 return isFileExists29 (filePath );
6475 }
@@ -79,16 +90,6 @@ private static boolean isFileExists29(String filePath) {
7990 return true ;
8091 }
8192
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-
9293 /**
9394 * Rename the file.
9495 *
You can’t perform that action at this time.
0 commit comments