How to find a directory?

MjK

Member
Licensed User
Longtime User
Hi everybody,

I've got a very simple app on Google Play. It's an AddOn for another app. It just copies some files from dirassets to a subfolder of the other app.
This worked fine for more than a year now, but with more and more devices coming up, there more and more different directories where the app is installed.

For example, I am using the following directories:
/sd/
/mnt/sd/
/sdcard_externalsd/
/mnt/sdcard_externalsd/
/sdcard/external_sd/
/mnt/sdcard/external_sd/
and so on...

After some researches in this forum and the documentation i've tried
DirRootExternal
DirDefaultExternal
DirInternal

But none of them seem to work for some specific devices like Huawei, Medion or Archos.

Is there a way, how to find these directories on these devices without adding them manually?

Cheers, MjK
 

MjK

Member
Licensed User
Longtime User
Thanks for fast answer, I was worried about this.

Hmm... So best solution is to ask my users, how these paths are called on their devices?

Would a customized search for "/appfolder/subfolder/" work?
 
Upvote 0

MjK

Member
Licensed User
Longtime User
So I am talking about that mapping application "Locus". Locus saves the databases, exports and so on in "/mnt/sdcard/Locus/subfolders/".
My addon "Locus Map Tweak" for this app just copies some files in one of these subfolders.

Could I do a search for a file located in /"Locus/data/" and is called "dbmain.sqll" and some code gives me the correct part of the file system, e.g. "/mnt/sdcard1/ext/"?
 
Upvote 0

MjK

Member
Licensed User
Longtime User
The code in that link returns an empty string if the path was not found. Otherwise it returns the path.

Well, I don't expect any ready code, the fun part about learning would be missing ;)
But I'd appreciate any hint to a working solution to do this task programmatically.

I've had 2 another ideas, how to solve it:
(1) Write a textfile with all directories and subdirectories and pick the matching path out of it.
(2) Start the other app and monitor every file changes.

Idea (1) seems the less complicated way, as there can be file changes made by the system itself at the same time.

Which part at the beginners guide do you recommend for this task?
And BTW, thanks for helping!
 
Upvote 0
Top