mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
refactor(fs)!: remove read_text_file and write_text_file commands (#3605)
`readTextFile` and `writeTextFile` now go through `read_file` and `write_file`, so the `allow-read-text-file`, `deny-read-text-file`, `allow-write-text-file` and `deny-write-text-file` permissions are gone; grant `fs:allow-read-file` and `fs:allow-write-file` instead.
This commit is contained in:
@@ -605,26 +605,6 @@ pub struct ReadTextFileOptions {
|
||||
encoding: Option<String>,
|
||||
}
|
||||
|
||||
// TODO, remove in v3, rely on `read_file` command instead
|
||||
#[tauri::command]
|
||||
pub async fn read_text_file<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
global_scope: GlobalScope<Entry>,
|
||||
command_scope: CommandScope<Entry>,
|
||||
path: SafeFilePath,
|
||||
options: Option<BaseOptions>,
|
||||
) -> CommandResult<tauri::ipc::Response> {
|
||||
read_file_inner(
|
||||
"read-text-file",
|
||||
webview,
|
||||
global_scope,
|
||||
command_scope,
|
||||
path,
|
||||
options,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn read_text_file_lines<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
@@ -1167,24 +1147,6 @@ pub async fn write_file<R: Runtime>(
|
||||
write_file_inner("write-file", webview, global_scope, command_scope, request).await
|
||||
}
|
||||
|
||||
// TODO, remove in v3, rely on `write_file` command instead
|
||||
#[tauri::command]
|
||||
pub async fn write_text_file<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
global_scope: GlobalScope<Entry>,
|
||||
command_scope: CommandScope<Entry>,
|
||||
request: tauri::ipc::Request<'_>,
|
||||
) -> CommandResult<()> {
|
||||
write_file_inner(
|
||||
"write-text-file",
|
||||
webview,
|
||||
global_scope,
|
||||
command_scope,
|
||||
request,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn exists<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
|
||||
@@ -464,7 +464,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<config::Config>> {
|
||||
commands::read_dir,
|
||||
commands::read,
|
||||
commands::read_file,
|
||||
commands::read_text_file,
|
||||
commands::read_text_file_lines,
|
||||
commands::read_text_file_lines_next,
|
||||
commands::remove,
|
||||
@@ -477,7 +476,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<config::Config>> {
|
||||
commands::ftruncate,
|
||||
commands::write,
|
||||
commands::write_file,
|
||||
commands::write_text_file,
|
||||
commands::exists,
|
||||
commands::size,
|
||||
commands::start_accessing_security_scoped_resource,
|
||||
|
||||
Reference in New Issue
Block a user