Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow listing / and /storage/emulated folders #352

Merged
merged 6 commits into from
Jun 9, 2024

Conversation

lmagyar
Copy link
Contributor

@lmagyar lmagyar commented Jun 2, 2024

On (some?) non-rooted phones listing the / folder and the /storage/emulated returns nothing. Related #279 #293 #299 #305

First workaround is to let at least return an empty list, that's why isReadable() is changed to isExecutable().

SecondThe workaround is more like a hack, because I couldn't find any way to list the root folders, though when I enter them directly (like /system), they work fine in read-only mode. So I've added a way to fake/inject any folder listing if the OS doesn't list anything for us.

Currently only the /storage and /storage/emulated/0 is faked (the others are commented out in the code). This is helpful for the "average" user, because at least there is a path to the internal and external storage throught clicking in eg. WinSCP, without direct knowledge of the Android file-system's structure.

@lmagyar
Copy link
Contributor Author

lmagyar commented Jun 2, 2024

After some experiments I decided to set isReadable and isExecutable true on all faked/injected folders, and their parents also (/storage/emulated, looking at you). This works on WinSCP, SSHFS, SSHFS + cmd prompt, SSHFS + Win Explorer. It just works.

@lmagyar lmagyar marked this pull request as ready for review June 2, 2024 20:30
@wolpi wolpi added this to the 7.2 milestone Jun 9, 2024
@wolpi wolpi merged commit 7bab635 into wolpi:master Jun 9, 2024
1 check passed
@wolpi
Copy link
Owner

wolpi commented Jun 9, 2024

Ok, code is simple enough to support this.

@lmagyar lmagyar deleted the pr-allow-listing-the-root-folder branch June 9, 2024 15:31
@lmagyar lmagyar restored the pr-allow-listing-the-root-folder branch June 9, 2024 15:32
@lmagyar lmagyar deleted the pr-allow-listing-the-root-folder branch June 9, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants