Skip to content

Commit

Permalink
fix: file path issue in download folder
Browse files Browse the repository at this point in the history
  • Loading branch information
gowtham.balamurugan committed Jun 26, 2023
1 parent 4bee019 commit 0d85c6e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,17 @@ public static String getPath(Context context, final Uri uri) {
if (cursor != null && cursor.moveToFirst()) {
String fileName = cursor.getString(0);
String path = Environment.getExternalStorageDirectory().toString() + "/Download/" + fileName;
if (!TextUtils.isEmpty(path)) {
if (!TextUtils.isEmpty(path) && new File(path).exists()) {
return path;
}else{
return copyFileToInternalStorage(context,uri,"");
}
}
}
finally {
if (cursor != null)
if (cursor != null) {
cursor.close();
}
}
id = DocumentsContract.getDocumentId(uri);
if (!TextUtils.isEmpty(id)) {
Expand Down

0 comments on commit 0d85c6e

Please sign in to comment.