itkach / aard2-android

Aard2 for Android, a simple dictionary app
GNU General Public License v3.0
426 stars 98 forks source link

Cannot navigate path /storage/emulated/0 #128

Closed JJRcop closed 2 years ago

JJRcop commented 2 years ago

I tried to manually add a dictionary located directly on my device. The path for this is /storage/emulated/0.

When using the plus sign on the dictionaries menu, attempting to navigate to /storage/emulated does not display any directories, so I am unable to navigate past this point to /storage/emulated/0.

I believe this is how android access permissions are set up. Attempting to list the contents of /storage/emulated is denied, but trying to access /storage/emulated/0 directly is permitted.

It would be nice to allow the app to use my phone's file location menu that other apps take advantage of, which has shortcuts to Internal Storage, and even SD Card.

itkach commented 2 years ago

From what I saw on various devices, same external storage is often available under several different paths (e.g. /sdcard and /mnt/sdcard) and some of those paths are browsable. Is that not the case for you? I'm curious what's the device/Android version and does automatic dictionary discovery work for you?

It would be nice to allow the app to use my phone's file location menu that other apps take advantage of,

As far as I can tell, those provide access to actual file, not file locations, as in "you can open input stream and read it, but you can't know where the file is and open it yourself". This is not good enough because working with dictionaries requires random access which content resolver api does not provide (on purpose, so it seems)

JJRcop commented 2 years ago

same external storage

The dictionary files I want to use are located on internal storage, which is the problem. I did find that for some reason my phone does map internal storage to /sdcard, so that works, thanks, but it seems quite weird to me, and /storage/emulated/0 appears to be the "proper" path that I would prefer to use.

Essentially using /sdcard feels like an ugly hack, and it would be nice to see that resolved.

Additionally, I hope you see that the premise of this issue isn't about being blocked from doing something, but trying to smooth over an oversight/ugly anomaly that most other apps handle well. So answers like "well just use your SD card", while they work, miss the point a bit.

itkach commented 2 years ago

Unfortunately this is not an anomaly, the way Android/device manufacturers handle internal and external storage is messy and inconsistent.

most other apps handle well

which other apps, handle how?

I am not sure what exactly would you like me to do here.

JJRcop commented 2 years ago

I think a field to enter a path manually with the keyboard could solve this, then I could type /storage/emulated/0. Other apps would include a shortcut button to internal storage, Documents, Downloads, SD card, etc, but that might not be necessary.

itkach commented 2 years ago

Dictionary selection in 0.49 now uses native document chooser.

francwalter commented 2 years ago

grafik

None of my dictionaries work anymore now. But I could, after deleting them first, easily put them back :)

itkach commented 2 years ago

Yes, you have to remove and re-add them. Old file paths can't work anymore.

JJRcop commented 2 years ago

As far as I can tell, those provide access to actual file, not file locations, as in "you can open input stream and read it, but you can't know where the file is and open it yourself". This is not good enough because working with dictionaries requires random access which content resolver api does not provide (on purpose, so it seems)

Have you resolved this concern with the solution implemented in 0.49?

itkach commented 2 years ago

Yes. Turns out with SAF it's possible to get access via FileChannel which provides api similar to RandomAccessFile that was used before.