Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[path_provider] now supports getDownloadsDirectory() on macOS. #2436

Merged
merged 11 commits into from
Jan 28, 2020
Merged

[path_provider] now supports getDownloadsDirectory() on macOS. #2436

merged 11 commits into from
Jan 28, 2020

Conversation

technolion
Copy link
Contributor

@technolion technolion commented Dec 23, 2019

Description

This PR adds support for retrieving a user's downloads directory on macOS using the path_provider plugin. The native code is done in the sub project path_provider_macos.

Related Issues

Fixes flutter/flutter#47676

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@technolion
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@franciscojma86
Copy link
Contributor

I just created flutter/flutter#47851 (couldn't tag you for some reason). We need to federate this plugin as there are many platform specific APIs. If you are interested in this, please feel free to drive it :)

For this PR, it might be OK to just add this one API for now since it already most of the current APIs are platform specific. @amirh to make the call here.

@technolion
Copy link
Contributor Author

This is a very simple change set. When can we expect this to get reviewed and hopefully merged?

Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to bump the path_provider version and add a changelog entry as well, other than that LGTM.

Side note: I'm wondering whether it would be useful for this plugin to have a way to dynamically check which directories are supported (vs. trying and seeing if an exception was thrown). My thinking is that it's probably more convenient to write app code to branch on whether a given directory is supported vs. which platform we're running on.

Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry marked approved instead of request changes - we need to update the version for path_provider before landing

@technolion technolion requested a review from amirh January 24, 2020 14:32
@technolion technolion requested a review from amirh January 28, 2020 14:53
@amirh amirh merged commit a99812b into flutter:master Jan 28, 2020
@technolion technolion deleted the path_provider_downloads branch January 29, 2020 08:40
@technolion
Copy link
Contributor Author

technolion commented Jan 29, 2020

Thanks for merging! When is going to be published on https://pub.dev/packages/path_provider ?

@technolion
Copy link
Contributor Author

technolion commented Jan 30, 2020

I see it has been published now. Thanks again!

EdwinRomelta pushed a commit to EdwinRomelta/plugins that referenced this pull request Jun 11, 2020
…er#2436)

Adds support for retrieving a user's downloads directory on macOS using the path_provider plugin.
@Faiizii
Copy link

Faiizii commented Nov 20, 2020

Unhandled Exception: Unsupported operation: Functionality only available on macOS on calling var dirs = (await getDownloadsDirectory());
still facing this issue. here is my flutter --version logs

Flutter 1.23.0-18.1.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision 198df796aa (5 weeks ago) • 2020-10-15 12:04:33 -0700 Engine • revision 1d12d82d9c Tools • Dart 2.11.0 (build 2.11.0-213.1.beta)

let me know if I am doing anything wrong
Note: I already checked for platform before calling getDownloadsDirectory()

FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
…er#2436)

Adds support for retrieving a user's downloads directory on macOS using the path_provider plugin.
@stuartmorgan-g
Copy link
Contributor

stuartmorgan-g commented Nov 20, 2020

channel beta

If you are on beta, you can't be running a macOS application, so this PR would not be relevant.

@technolion
Copy link
Contributor Author

Yes, try to

flutter channel dev
flutter upgrade
flutter pub get

Then it should work.

@stuartmorgan-g
Copy link
Contributor

@technolion I think you misunderstood my comment. @Faiizii is seeing an error message, and is thus running something. But it's on beta channel, which means that whatever that something is, it's not a macOS application. Running that non-macOS Flutter app on a different channel isn't going to change anything about that error, or make this PR relevant.

@technolion
Copy link
Contributor Author

You are right @stuartmorgan. I got confused about by the error message talking about macOS.
The problem was fixed by me in this PR, which removes the pre-screening:
#3017
Unfortunately this PR was not yet merged. Is there something that is expected from me to fullfill any precondition to get it merged?

@stuartmorgan-g
Copy link
Contributor

The problem was fixed by me in this PR, which removes the pre-screening

Unless @Faiizii is using a third-party method-channel-based unendorsed implementation of the plugin, that PR will just replace one error method with a different one. There are no implementations in flutter/plugins that are currently gated behind that check.

Unfortunately this PR was not yet merged. Is there something that is expected from me to fullfill any precondition to get it merged?

As a starting point, it would need to have the test failures addressed. Then it needs a review; there's a large backlog and that PR is low priority since it doesn't fix any current issue (although it could avoid issues in the future, and is the right change to make).

@lekeCoder
Copy link

can we get a similar feature for Android? I initially thought getDownloadDirectory() would help get the Downloads folder in Android

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[path_provider] Support for retrieving user's downloads folder on macOS
7 participants