wolpi / prim-ftpd

FTP server app for android
Other
620 stars 78 forks source link

Allow listing / and /storage/emulated folders #352

Closed lmagyar closed 3 months ago

lmagyar commented 4 months ago

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().~

~Second~The 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 commented 4 months ago

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.

wolpi commented 3 months ago

Ok, code is simple enough to support this.