FileTools : Some tools to work with files

How do I dynamically get the root path of the directory where my app is installed?

In the Internal Storage, the app package is stored, which can only be accessed with a rooted device.

What does ‚Äúdynamically‚ÄĚ mean?

1 Like

I need to access a File.pdf with Start Activity. On my android 8.1 device I used the URI. file: ///sdcard/Makeroid/library/File.pdf. But on my other android 4.4 device it only worked with the URI. file: ///storage/Makeroid/library/File.pdf.
according to the device the uri will be started with sdcard or storage how can i identify this automatically?

you could use

  1. a relative path, which is /library/File.pdf or
  2. a full generic path, which is file:///mnt/sdcard/library/File.pdf

EDIT: are you trying to read a file form the assets of the app? this will not work like this…


1 Like

The root directory of the External Storage is:

file:///mnt/sdcard/ or

is the same as:
file:///storage/emulated/0/Makeroid/library/ or

These dirs are visible / accessible on your device, where (from an Android point of view) this ‚ÄúExternal Storage‚ÄĚ is called ‚ÄúInternal Storage‚ÄĚ (see below):
Internal Storage > Makeroid > library

For a webView the path to the assets is for the compiled app (APK):
and for Companion:

From an Android point of view there are an Internal Storage and an External Storage.

1. Internal Storage
In the Internal Storage, the app package is saved:


which can only be accessed with a rooted device.

2. External Storage
The root directory of the External Storage is:


2.1. App-specific directory
In addition, there may be an app-specific directory (which can be created with Taifun’s File extension: App Inventor Extensions: File | Pura Vida Apps or the FileTools extension)


which is saved in the External (private) Storage, but does not require READ_ / WRITE_EXTERNAL_STORAGE permissions.
This app-specific (private) folder can only be accessed by your app.

See: Manifest.permission  |  Android Developers

2.2. Removable (micro) SD card
There may also be another External Storage: a removable (micro) SD card, eg:


that can only be read (on modern Android systems, since Android KitCat).

The root directory of the External Storage


is displayed on the device as Internal Storage (unfortunately this is a bit ambiguous).


Great! I’ve learned a lot about this.
But I wonder if there is a way to find out if the APK has been installed on internal or external storage. Is there this possibility?

As I said: /data/data/<packageName>/ (see above: 1. Internal Storage)

See here for an excellent overview on this topic:

"Internal storage is used to store android app private data such as files, cached files, shared_preferences and database files.

All those files is stored in android device folder /data/data/<app packageName>/ . And only the android app can operate those files. In general internal storage files is saved in android device build-in flash disk memory."

It worked! It ran on two devices (the apk installed one on internal sdcard and one on external storage) using only the path: file: /// storage / emulated / 0 / Android / data / packname / files.
Thanks for listening! \The/

Copying from the assets does not work for APK (checked with AI2):

Two slashes from file:///android_asset/ are removed, result:
Runtime Error: file:/android_asset/test.1.pdf (No such file or directory)

usually (and this is how the file component is implemented) to access the assets you have to use two slashes //, see also the documentation Storage

Prefix the filename with / to read from a specific file on the SD card. for instance /myFile.txt will read the file /sdcard/myFile.txt. To read assets packaged with an application (also works for the Companion) start the filename with // (two slashes).

in case this extension uses another logic, it would not be very helpful and would confuse everybody…

btw. the path file:///android_asset/ is only relevant for the webviewer to access files stored in the assets…


1 Like

Of course, I have tried this first: //test1.pdf
Doesn’t work:
Runtime Error: /test.1.pdf (No such file or directory)

Thanks @bodymindpower :heart_eyes:
I hope next version will solve this and other issues/bugs :wink:


Video on how to use…copy from SD card to phone or vise versa

ChangeLog Version4

New blocks
Added 6 new blocks:


  • Replaced path with name.Now it will find path automatically from file name (Thanks to App Inventor)
  • Some other minor changes

Bug Fixes

  • Now it is able to copy files from assets (Thanks @bodymindpower)
  • ‚ÄėAvailableStorageDirectories‚Äô block is working now (Thanks @salem_m_s2021)

Is there more than thank you

1 Like

I have no idea about that :upside_down_face:

1 Like

We need an extension of that :crazy_face: :joy:

1 Like

There is already an extension :innocent:

1 Like

ChangeLog Version5


  • Added ‚Äėrecursive‚Äô in FilesList and FileListAsync



Bug Fixes

  • Fixed bug in Delete method
  • Fixed bug in getting assets list using FilesList.Use // in FilesList as dir to get Assets list while using Companion
  • Some minor bug fixes

Due to this extension my automatically my mobile’s all images and videos and other files lost when i export my app and install it, I dont used this extension in blocks remains unchanged, get file path only this block is used… and after installing all data lost… if it is a bug then solve it… if it is hacked then dont use anyone…