From d379e1bfa79e0c3cd69aac6ea188920f7e834ba2 Mon Sep 17 00:00:00 2001 From: Dogbonee Date: Mon, 17 Feb 2025 13:16:43 -0700 Subject: [PATCH 1/2] Savefile now returns correct path --- .../com/mr/flutter/plugin/filepicker/FilePickerDelegate.java | 3 +-- example/lib/src/file_picker_demo.dart | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java index 9212d8e1..0e09df29 100644 --- a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java +++ b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java @@ -77,8 +77,7 @@ public boolean onActivityResult(final int requestCode, final int resultCode, fin this.dispatchEventStatus(true); final Uri uri = data.getData(); if (uri != null) { - String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) - .getAbsolutePath() + File.separator + FileUtils.getFileName(uri, this.activity); + String path = FileUtils.getRealPathFromURI(this.activity, uri); try { OutputStream outputStream = this.activity.getContentResolver().openOutputStream(uri); if(outputStream != null){ diff --git a/example/lib/src/file_picker_demo.dart b/example/lib/src/file_picker_demo.dart index b34b1a78..3c1175ab 100644 --- a/example/lib/src/file_picker_demo.dart +++ b/example/lib/src/file_picker_demo.dart @@ -123,6 +123,7 @@ class _FilePickerDemoState extends State { fileName: _defaultFileNameController.text, initialDirectory: _initialDirectoryController.text, lockParentWindow: _lockParentWindow, + bytes: Uint8List(0), ); setState(() { _saveAsFileName = fileName; From fe6bdc96c3f8c22c096000e251c1b8afe7dd3bdf Mon Sep 17 00:00:00 2001 From: Dogbonee Date: Mon, 17 Feb 2025 13:42:19 -0700 Subject: [PATCH 2/2] Contribution guideline changes --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7d05da2..0e9f268e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 9.0.1 +### Android +- Fixes an issue where `saveFiles()` would return an incorrect path. [#1636](https://github.com/miguelpruivo/flutter_file_picker/issues/1636) + ## 9.0.0 ### Web - **BREAKING CHANGE:** `pickFiles()` now loads files as blobs. See the note in the updated [wiki](https://github.com/miguelpruivo/flutter_file_picker/wiki/api#-pickfiles) diff --git a/pubspec.yaml b/pubspec.yaml index c9739c37..6cae612d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A package that allows you to use a native file explorer to pick sin homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker repository: https://github.com/miguelpruivo/flutter_file_picker issue_tracker: https://github.com/miguelpruivo/flutter_file_picker/issues -version: 9.0.0 +version: 9.0.1 dependencies: flutter: