Android Question Get toplevel accessible paths from internal memory and SD card

Nickelgrass

Active Member
Licensed User
Longtime User
Hello,

I am making a very simple directory chooser. So far all works fine an I can access internal memory and the SD card. There is just one little thing bugging me.

When getting all the available storage devices with "For Each s As String In rp.GetAllSafeDirsExternal("")" then I get the internal memory and SD card paths appended with the app's file path. That means "/storage/emulated/0/Android/data/b4a.example/files" for the internal and "/storage/1234-1234/Android/data/b4a.example/files" for SD card. I can access both paths up to the ""/storage/emulated/0/" and "/storage/1234-1234/". Now the question is if it is safe to presume that all paths will always include the "/Android/" part. If so I could simply cut the paths of from "Android/" on and have my valid top level paths. Or could it be on different devices that these paths could be anything else? Or can I compare the paths and cut all folders that match from the bottom up?
What would be the safest way to get the top level folders?
 

Nickelgrass

Active Member
Licensed User
Longtime User
I don't know what you mean by "safest way" and don't understand why you want to "cut" the paths but the safe paths will always be in the format "<storagepartition>/Android/data/<mypackagename>/files."
Sorry, I did not know how to otherwise formulate my question. Your answer however answered my question, thank you!
 
Upvote 0
Top