aakashkondhalkar / external_path

Flutter package
MIT License
13 stars 19 forks source link

Wrong screenshots directory #2

Open BoHellgren opened 2 years ago

BoHellgren commented 2 years ago

ExternalPath.DIRECTORY_SCREENSHOTS gives me /storage/emulated/0/Screenshots but on my Samsung S10e the screenshots are in /storage/emulated/0/DCIM/Screenshots

aakashkondhalkar commented 2 years ago

use ExternalPath.DIRECTORY_DCIM and Then append /Screenshots to get correct screenshots directory

BoHellgren commented 2 years ago

That is an obvious bypass and this is what I use

 String dir1 = await ExternalPath.getExternalStoragePublicDirectory(ExternalPath.DIRECTORY_SCREENSHOTS);
      String dir2 = await ExternalPath.getExternalStoragePublicDirectory(ExternalPath.DIRECTORY_DCIM);
      String dir3 = await ExternalPath.getExternalStoragePublicDirectory(ExternalPath.DIRECTORY_PICTURES);
      Directory downDir = Directory(dir1);
      if (!downDir.existsSync()) {
        downDir = Directory(dir2 + r'/Screenshots');
        if (!downDir.existsSync()) {
          downDir = Directory(dir3 + r'/Screenshots');
          if (!downDir.existsSync()) {
            return 'noDirectory';
          }
        }

This code should be in the extenal_path plugin. As it stands now, ExternalPath.DIRECTORY_SCREENSHOTS returns the wrong directory on several models, which I consider a bug.