@@ -250,8 +250,8 @@ else if(resolved == null) {
250250 static Map <String , Object > getSystemfolders (ReactApplicationContext ctx ) {
251251 Map <String , Object > res = new HashMap <>();
252252
253- res .put ("DocumentDir" , ctx . getFilesDir (). getAbsolutePath ( ));
254- res .put ("CacheDir" , ctx . getCacheDir (). getAbsolutePath ( ));
253+ res .put ("DocumentDir" , getFilesDirPath ( ctx ));
254+ res .put ("CacheDir" , getCacheDirPath ( ctx ));
255255 res .put ("DCIMDir" , getExternalFilesDirPath (ctx , Environment .DIRECTORY_DCIM ));
256256 res .put ("PictureDir" , getExternalFilesDirPath (ctx , Environment .DIRECTORY_PICTURES ));
257257 res .put ("MusicDir" , getExternalFilesDirPath (ctx , Environment .DIRECTORY_MUSIC ));
@@ -282,6 +282,18 @@ static String getExternalFilesDirPath(ReactApplicationContext ctx, String type)
282282 return "" ;
283283 }
284284
285+ static String getFilesDirPath (ReactApplicationContext ctx ) {
286+ File dir = ctx .getFilesDir ();
287+ if (dir != null ) return dir .getAbsolutePath ();
288+ return "" ;
289+ }
290+
291+ static String getCacheDirPath (ReactApplicationContext ctx ) {
292+ File dir = ctx .getCacheDir ();
293+ if (dir != null ) return dir .getAbsolutePath ();
294+ return "" ;
295+ }
296+
285297 static public void getSDCardDir (ReactApplicationContext ctx , Promise promise ) {
286298 if (Environment .getExternalStorageState ().equals (Environment .MEDIA_MOUNTED )) {
287299 try {
0 commit comments