#bug with android fs readdir and such

6 messages · Page 1 of 1 (latest)

winged vine
#

Tauri config:

{
  "app": {
    "security": {
      "assetProtocol": {
        "enable": true,
        "scope": ["$RESOURCE", "$RESOURCE/**"]
      }
    }
  },
  "bundle": {
    "resources": ["Resources/*"]
  }
}

The following code gives me an error on android:

const files = await readDir('Resources', { baseDir: BaseDirectory.Resource });

It gives failed to read directory at path: asset://localhost/Resources with error: No such file or directory (os error 2) error

When I try with this:

const p = await resolveResource('Resources');
const files = await readDir(p);

then android gives me an forbidden path: /Resources exception...

Oh and btw this does work on android.

const p = await resolveResource('Resources/Release-notes.txt');
const content = await readTextFile(p);

But when using the other method with baseDir:

const content = await readTextFile('Resources/Release-notes.txt', { baseDir: BaseDirectory.Resource });

then it doesnt work -> failed to open file at path: asset://localhost/Resources/Release-notes.txt with error: No such file or directory (os error 2):

grizzled slate
#

android limitations, you need to edit android gradle project to include file providers and etc

winged vine
#

Can you explain how to do that?

Cause it seems ilke the fileprovider already exists, but no reference to it in gradle project, tho...:

winged vine
winged vine
#

Oke... well idk what to do then