-
Trying to get fs api permissions to work, after app launch fs actions will fail with permission errors. Strangely I have found that if an Open file dialog is used to open the target file succeeding fs actions will work. They will continue to work even through app refreshes from the monitored dev folder but if the app is closed and relaunched then an fs read of the target file will only start working again after a dialog action. What does the dialog action do to negate the permissions problem and why should the fs action not work prior to the dialog action? app.js -
Result of fs init - works OK [Log] window.TAURI.fs (app.js, line 72) BaseDirectory: {1: "Audio", 2: "Cache", 3: "Config", 4: "Data", 5: "LocalData", 6: "Document", 7: "Download", 8: "Picture", 9: "Public", 10: "Video", …}
`
Result in debug console - [Error] Failed to load resource: the server responded with a status of 400 (Bad Request) (plugin:fs|read_text_file, line 0) ipc://localhost/plugin%3Afs%7Cread_text_file
Dialog code that allows succeeding fs reads to work - (selected file needs to be the same as succeeding selections) ` As I understand it V2 no longer accepts full/relative paths as V1 did so the file and additional subfolders need to be specified along with the BaseDirectory reference. Old case: V1 - var filecontent = await fs.readTextFile(selected); where selected was a full path New case: V2 - var filecontent = await fs.readTextFile('selected.name', { baseDir: fs.BaseDirectory.Desktop }); Tauri Info - [✔] Environment [-] Packages [-] App Plugins are all beta.2 (would be good if plugins were shown in the tauri info report). tauri.config.json - (old allowLists no longer used - files in capabilities folder now referenced) "identifier": "uk.org.wanderinghippo.winmanv2.dev",
},
migrated.json - (automagically processed by Tauri apparently) {
` |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Well these permissions in V2 are brutal - the issue of the bad permissions on launch appears to be the use of template/exe/runtime permissions being allowed (I think these may not apply to MacOS) - works a bit better when they were removed. Now the next issue - the new windows have no content! |
Beta Was this translation helpful? Give feedback.
Well these permissions in V2 are brutal - the issue of the bad permissions on launch appears to be the use of template/exe/runtime permissions being allowed (I think these may not apply to MacOS) - works a bit better when they were removed. Now the next issue - the new windows have no content!