Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Path not allowed on the configured scope in tauri app

$
0
0

I'm using writeTextFile() function to write json data into this file 'src-tauri/databases/db.json .

The readTextFile(resourcePath) work fine get the data from same json file

i'm using svelte

here the tauri config file look like :

"tauri": {"allowlist": {"all": true,"path": {"all": true      },"fs": {"all": true, "readFile": true,"writeFile": true,"readDir": true,"copyFile": true,"createDir": true,"removeDir": true,"removeFile": true,"renameFile": true,"exists": true,"scope": ["$RESOURCE/*","$RESOURCE/databases/*","$RESOURCE/databases/db.json"        ]      }    },"bundle": {"active": true,"identifier": "com.tauri.dev","targets": "all","resources": ["databases/*","databases/db.json"      ]    }}

here my code :

    import { resourceDir } from '@tauri-apps/api/path';    import { readTextFile, writeTextFile } from '@tauri-apps/api/fs'    await writeTextFile({ path: 'databases/db.json' , contents: data })

version:

    {"name": "svelt-pos","private": true,"version": "0.0.0","type": "module","scripts": {"dev": "vite","build": "vite build","preview": "vite preview","tauri": "tauri"      },"dependencies": {"@tauri-apps/api": "^1.2.0"      },"devDependencies": {"@sveltejs/vite-plugin-svelte": "^2.0.0","svelte": "^3.54.0","vite": "^4.2.1","@tauri-apps/cli": "^1.2.3"      }    }

Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>