Skip to content

Commit 4de910e

Browse files
committed
feat: rename command
1 parent 86253d1 commit 4de910e

File tree

11 files changed

+67
-70
lines changed

11 files changed

+67
-70
lines changed

plugins/dialog/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const COMMANDS: &[&str] = &[
66
"open",
77
"save",
8-
"stop_accessing_path",
8+
"destroy_path",
99
"message",
1010
"ask",
1111
"confirm",

plugins/dialog/guest-js/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Path {
1111
}
1212

1313
destroy() {
14-
return invoke('plugin:dialog|stop-accessing-path', { path: this.path })
14+
return invoke('plugin:dialog|destroy-path', { path: this.path })
1515
}
1616

1717
toPath() {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Automatically generated - DO NOT EDIT!
2+
3+
"$schema" = "../../schemas/schema.json"
4+
5+
[[permission]]
6+
identifier = "allow-destroy-path"
7+
description = "Enables the destroy_path command without any pre-configured scope."
8+
commands.allow = ["destroy_path"]
9+
10+
[[permission]]
11+
identifier = "deny-destroy-path"
12+
description = "Denies the destroy_path command without any pre-configured scope."
13+
commands.deny = ["destroy_path"]

plugins/dialog/permissions/autogenerated/commands/stop_accessing_path.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.

plugins/dialog/permissions/autogenerated/reference.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ All dialog types are enabled.
1414
- `allow-message`
1515
- `allow-save`
1616
- `allow-open`
17-
- `allow-stop-accessing-path`
17+
- `allow-destroy-path`
1818

1919
## Permission Table
2020

@@ -80,103 +80,103 @@ Denies the confirm command without any pre-configured scope.
8080
<tr>
8181
<td>
8282

83-
`dialog:allow-message`
83+
`dialog:allow-destroy-path`
8484

8585
</td>
8686
<td>
8787

88-
Enables the message command without any pre-configured scope.
88+
Enables the destroy_path command without any pre-configured scope.
8989

9090
</td>
9191
</tr>
9292

9393
<tr>
9494
<td>
9595

96-
`dialog:deny-message`
96+
`dialog:deny-destroy-path`
9797

9898
</td>
9999
<td>
100100

101-
Denies the message command without any pre-configured scope.
101+
Denies the destroy_path command without any pre-configured scope.
102102

103103
</td>
104104
</tr>
105105

106106
<tr>
107107
<td>
108108

109-
`dialog:allow-open`
109+
`dialog:allow-message`
110110

111111
</td>
112112
<td>
113113

114-
Enables the open command without any pre-configured scope.
114+
Enables the message command without any pre-configured scope.
115115

116116
</td>
117117
</tr>
118118

119119
<tr>
120120
<td>
121121

122-
`dialog:deny-open`
122+
`dialog:deny-message`
123123

124124
</td>
125125
<td>
126126

127-
Denies the open command without any pre-configured scope.
127+
Denies the message command without any pre-configured scope.
128128

129129
</td>
130130
</tr>
131131

132132
<tr>
133133
<td>
134134

135-
`dialog:allow-save`
135+
`dialog:allow-open`
136136

137137
</td>
138138
<td>
139139

140-
Enables the save command without any pre-configured scope.
140+
Enables the open command without any pre-configured scope.
141141

142142
</td>
143143
</tr>
144144

145145
<tr>
146146
<td>
147147

148-
`dialog:deny-save`
148+
`dialog:deny-open`
149149

150150
</td>
151151
<td>
152152

153-
Denies the save command without any pre-configured scope.
153+
Denies the open command without any pre-configured scope.
154154

155155
</td>
156156
</tr>
157157

158158
<tr>
159159
<td>
160160

161-
`dialog:allow-stop-accessing-path`
161+
`dialog:allow-save`
162162

163163
</td>
164164
<td>
165165

166-
Enables the stop_accessing_path command without any pre-configured scope.
166+
Enables the save command without any pre-configured scope.
167167

168168
</td>
169169
</tr>
170170

171171
<tr>
172172
<td>
173173

174-
`dialog:deny-stop-accessing-path`
174+
`dialog:deny-save`
175175

176176
</td>
177177
<td>
178178

179-
Denies the stop_accessing_path command without any pre-configured scope.
179+
Denies the save command without any pre-configured scope.
180180

181181
</td>
182182
</tr>

plugins/dialog/permissions/default.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ permissions = [
1717
"allow-message",
1818
"allow-save",
1919
"allow-open",
20-
"allow-stop-accessing-path"
20+
"allow-destroy-path"
2121
]

plugins/dialog/permissions/schemas/schema.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,18 @@
318318
"const": "deny-confirm",
319319
"markdownDescription": "Denies the confirm command without any pre-configured scope."
320320
},
321+
{
322+
"description": "Enables the destroy_path command without any pre-configured scope.",
323+
"type": "string",
324+
"const": "allow-destroy-path",
325+
"markdownDescription": "Enables the destroy_path command without any pre-configured scope."
326+
},
327+
{
328+
"description": "Denies the destroy_path command without any pre-configured scope.",
329+
"type": "string",
330+
"const": "deny-destroy-path",
331+
"markdownDescription": "Denies the destroy_path command without any pre-configured scope."
332+
},
321333
{
322334
"description": "Enables the message command without any pre-configured scope.",
323335
"type": "string",
@@ -355,22 +367,10 @@
355367
"markdownDescription": "Denies the save command without any pre-configured scope."
356368
},
357369
{
358-
"description": "Enables the stop_accessing_path command without any pre-configured scope.",
359-
"type": "string",
360-
"const": "allow-stop-accessing-path",
361-
"markdownDescription": "Enables the stop_accessing_path command without any pre-configured scope."
362-
},
363-
{
364-
"description": "Denies the stop_accessing_path command without any pre-configured scope.",
365-
"type": "string",
366-
"const": "deny-stop-accessing-path",
367-
"markdownDescription": "Denies the stop_accessing_path command without any pre-configured scope."
368-
},
369-
{
370-
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`\n- `allow-stop-accessing-path`",
370+
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`\n- `allow-destroy-path`",
371371
"type": "string",
372372
"const": "default",
373-
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`\n- `allow-stop-accessing-path`"
373+
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`\n- `allow-destroy-path`"
374374
}
375375
]
376376
}

plugins/dialog/src/commands.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use tauri::{command, Manager, Runtime, State, Window};
99
use tauri_plugin_fs::FsExt;
1010

1111
use crate::{
12-
Dialog, FileDialogBuilder, FilePath, MessageDialogButtons, MessageDialogKind, Result,
13-
StopAccessingPath, CANCEL, NO, OK, YES,
12+
Dialog, FileDialogBuilder, FilePath, MessageDialogButtons, MessageDialogKind, Result, CANCEL,
13+
NO, OK, YES,
1414
};
1515

1616
#[derive(Serialize)]
@@ -242,7 +242,7 @@ pub(crate) async fn save<R: Runtime>(
242242
}
243243

244244
#[command]
245-
pub fn stop_accessing_path(_p: StopAccessingPath) -> bool {
245+
pub fn destroy_path(_path: String) -> bool {
246246
true
247247
}
248248

plugins/dialog/src/desktop.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rfd::{AsyncFileDialog, AsyncMessageDialog};
1313
use serde::de::DeserializeOwned;
1414
use tauri::{plugin::PluginApi, AppHandle, Runtime};
1515

16-
use crate::{models::*, FileDialogBuilder, FilePath, MessageDialogBuilder, StopAccessingPath, OK};
16+
use crate::{models::*, FileDialogBuilder, FilePath, MessageDialogBuilder, OK};
1717

1818
pub fn init<R: Runtime, C: DeserializeOwned>(
1919
app: &AppHandle<R>,
@@ -207,10 +207,7 @@ pub fn save_file<R: Runtime, F: FnOnce(Option<FilePath>) + Send + 'static>(
207207
});
208208
}
209209

210-
pub fn stop_accessing_path<R: Runtime>(
211-
_dialog: FileDialogBuilder<R>,
212-
_p: StopAccessingPath,
213-
) -> bool {
210+
pub fn destroy_path<R: Runtime>(_dialog: FileDialogBuilder<R>, _path: String) -> bool {
214211
true
215212
}
216213

plugins/dialog/src/lib.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png"
1010
)]
1111

12-
use serde::{Deserialize, Serialize};
12+
use serde::Serialize;
1313
use tauri::{
1414
plugin::{Builder, TauriPlugin},
1515
Manager, Runtime,
@@ -180,7 +180,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
180180
.invoke_handler(tauri::generate_handler![
181181
commands::open,
182182
commands::save,
183-
commands::stop_accessing_path,
183+
commands::destroy_path,
184184
commands::message,
185185
commands::ask,
186186
commands::confirm
@@ -338,11 +338,6 @@ pub(crate) struct FileDialogPayload<'a> {
338338
multiple: bool,
339339
}
340340

341-
#[derive(Debug, Serialize, Deserialize)]
342-
pub struct StopAccessingPath {
343-
path: FilePath,
344-
}
345-
346341
// raw window handle :(
347342
unsafe impl<R: Runtime> Send for FileDialogBuilder<R> {}
348343

@@ -573,8 +568,8 @@ impl<R: Runtime> FileDialogBuilder<R> {
573568
save_file(self, f)
574569
}
575570

576-
pub fn stop_accessing_path(self, p: StopAccessingPath) -> bool {
577-
stop_accessing_path(self, p)
571+
pub fn destroy_path(self, path: String) -> bool {
572+
destroy_path(self, path)
578573
}
579574
}
580575

@@ -689,7 +684,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
689684
blocking_fn!(self, save_file)
690685
}
691686

692-
pub fn blocking_stop_accessing_path(self, p: StopAccessingPath) -> bool {
693-
self.stop_accessing_path(p)
687+
pub fn blocking_destroy_path(self, path: String) -> bool {
688+
self.destroy_path(path)
694689
}
695690
}

0 commit comments

Comments
 (0)