EFile : Only asks for permissions when required

1. Introduction

EFile is a modified version of the original File component. The only difference between File component and the extension is that the extension does not ask for write permission if you want to write to Application Specific Directory and read permission if you want to read from Application Specific Directory or Assets.

Latest Version: 4
Released:  June 11, 2020
Last Updated:  June 23, 2021

2. Blocks

image
image

3. Documentation

  • After File Saved
    Event indicating that the contents of the file have been written.
    component_event
    fileName ~ text
  • Got Text
    Event indicating that the contents from the file have been read.
    component_event (1)
    text ~ text
  • Append To File
    Appends text to the end of a file storage, creating the file if it does not exist.See the help text under SaveFile for information about where files are written.
    component_method
    text ~ text
    fileName ~ text
  • Get Cache Dir Path
    Returns the absolute path to the application specific cache directory on the filesystem
    image
    Returns : text
  • Get Private Dir Path
    Returns app’s private storage directory path
    image
    Returns : text
See here why is it important: https://community.appinventor.mit.edu/t/problem-with-july-30-2020-version-nb184-no-longer-able-to-write-and-read-files/13929
  • Get External Storage Path
    Returns external storage path
    image
    Returns : text
  • Get Application Specific Dir Path
    Returns asd path
    image
  • Read From
    Reads text from a file in 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). If a filename does not start with a slash, it will be read from the applications private storage (for packaged apps) and from /sdcard/AppInventor/data for the AI Companion and /sdcard/Makeroid/data for Kodular Companion.
    component_method (1)
    fileName ~ text
  • Save File
    Saves text to a file. If the filename begins with a slash (/) the file is written to the sdcard. For example writing to /myFile.txt will write the file to /sdcard/myFile.txt. If the filename does not start with a slash, it will be written in the programs private data directory where it will not be accessible to other programs on the phone. There is a special exception for the AI/Kodular Companion where these files are written to /sdcard/AppInventor/data (and /sdcard/Makeroid/data for Kodular) to facilitate debugging. Note that this block will overwrite a file if it already exists.If you want to add content to a file use the append block.
    component_method (2)

4. Downloads

Hope it helps!

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments