FileTools : Some tools to work with files

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…

Taifun

2 Likes

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

1 Like

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

3 Likes

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

ChangeLog Version4

New blocks
Added 6 new blocks:

Changes

  • 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)
7 Likes

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

Changes

  • Added ‘recursive’ in FilesList and FileListAsync

image

image

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
6 Likes

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…

1 Like

you might want to provide a screenshot of your relevant blocks…
and why do you think, the extension deleted all these files?
Taifun

1 Like

I don’t think it is even possible…but you can give more details so that I can fix bugs if there is any…

It is quite confusing…you should elaborate more…

1 Like

I think when we use delete file component and set path to empty it will delete all files…

No it will not delete all files if path is set to empty…but it will delete all files if path is set to / because it is path toroot folder which contains all files of SD card.

4 Likes

I think thats my problem… thank you…

One of the reasons I never liked this block

bild

4 Likes

ChangeLog Version 6

Changes

  • Removed some un-neccessary methods and imports which reduced aix size (40 kb to 31kb) :sweat_smile:
  • Some internal changes like using empty string in any path socket will also return an empty string
    Thanks to @Boban BTW, Looks like you still have an old version of extension :smile:
  • Fixed several spelling and grammar mistakes
1 Like

Thank for the extension.

Could you please assist me to delete a file in the APK?

Both companions and APK return file exists=true but only in companion delete successfully.

image