Is there a consistent directory?

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
bichlepa
Posts: 148
Joined: 04 Mar 2014 18:29
Location: Germany
Contact:

Is there a consistent directory?

Post by bichlepa » 09 Jul 2014 17:22

As far as I know there are different folder structures on different devices. How can I ensure that my flow that uses actions like "write to file" will work on every device?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Is there a consistent directory?

Post by Martin » 11 Jul 2014 08:32

The folder structure/directory names can vary a lot across devices. /mnt/sdcard/ is available on many devices to access the primary external storage, probably for compatibility reasons of older apps.
I will add a new function getExternalStorageDir() in the next version to get the root directory of the external storage so you could build actions like Write to File: abc to {getExternalStorageDir()}/file.txt.

User avatar
bichlepa
Posts: 148
Joined: 04 Mar 2014 18:29
Location: Germany
Contact:

Re: Is there a consistent directory?

Post by bichlepa » 11 Jul 2014 10:43

It's a nice solution. Thanks.

User avatar
bichlepa
Posts: 148
Joined: 04 Mar 2014 18:29
Location: Germany
Contact:

Re: Is there a consistent directory?

Post by bichlepa » 09 May 2017 16:23

Could you also make a function to get the path of the inserted external SD card?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Is there a consistent directory?

Post by Martin » 11 May 2017 19:36

To my knowledge there's still no good way to get the root of the real SD card that works on all devices.
You could ask the user to provide the path and store it in a global variable. Unofficial function getExternalFilesDirs() in a script returns a list of places Automagic could place files. You could loop over this list to determine if the second entry is the external sd card. Some devices might have multiple external sd cards.

Regards,
Martin

Post Reply